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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-05-07 02:19:13 +0400
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-05-07 02:19:13 +0400
commit6c86b70145ee46b647061f4b6455c3e82268df36 (patch)
tree629630f3cc6b6f44ffd5072da5dd81e57fd9861b /source/blender/editors
parent2ebebc563e2722ee08ffc0fb9204522964538df1 (diff)
parent5fb53b6b301c5ed03cdb3f800bb4af9395369a8f (diff)
svn merge ^/trunk/blender -r46000:46100
some conflicts. had to backup my code, accept with "tc" and introduce my own code again. Hope I didnt leave anything out.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c52
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_deps.c2
-rw-r--r--source/blender/editors/animation/anim_draw.c12
-rw-r--r--source/blender/editors/animation/anim_filter.c59
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c2
-rw-r--r--source/blender/editors/animation/anim_markers.c10
-rw-r--r--source/blender/editors/animation/drivers.c22
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c8
-rw-r--r--source/blender/editors/animation/keyframes_draw.c8
-rw-r--r--source/blender/editors/animation/keyframes_general.c12
-rw-r--r--source/blender/editors/animation/keyframing.c31
-rw-r--r--source/blender/editors/animation/keyingsets.c30
-rw-r--r--source/blender/editors/armature/armature_intern.h1
-rw-r--r--source/blender/editors/armature/armature_ops.c3
-rw-r--r--source/blender/editors/armature/editarmature.c269
-rw-r--r--source/blender/editors/armature/editarmature_generate.c48
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c836
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c750
-rw-r--r--source/blender/editors/armature/meshlaplacian.c18
-rw-r--r--source/blender/editors/armature/poseSlide.c10
-rw-r--r--source/blender/editors/armature/poseUtils.c16
-rw-r--r--source/blender/editors/armature/poselib.c24
-rw-r--r--source/blender/editors/armature/poseobject.c117
-rw-r--r--source/blender/editors/armature/reeb.c822
-rw-r--r--source/blender/editors/curve/editcurve.c290
-rw-r--r--source/blender/editors/curve/editfont.c29
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c6
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c28
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c12
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/include/ED_clip.h5
-rw-r--r--source/blender/editors/include/ED_curve.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h8
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/ED_uvedit.h5
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
-rw-r--r--source/blender/editors/interface/interface_layout.c18
-rw-r--r--source/blender/editors/interface/interface_templates.c8
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c12
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/editors/mesh/editface.c8
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.c18
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.h5
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c2
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c4
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c13
-rw-r--r--source/blender/editors/mesh/editmesh_select.c6
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c17
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c204
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/mesh_intern.h5
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c2
-rw-r--r--source/blender/editors/mesh/mesh_ops.c3
-rw-r--r--source/blender/editors/mesh/meshtools.c36
-rw-r--r--source/blender/editors/metaball/mball_edit.c4
-rw-r--r--source/blender/editors/object/object_add.c685
-rw-r--r--source/blender/editors/object/object_bake.c826
-rw-r--r--source/blender/editors/object/object_constraint.c465
-rw-r--r--source/blender/editors/object/object_edit.c730
-rw-r--r--source/blender/editors/object/object_group.c90
-rw-r--r--source/blender/editors/object/object_hook.c321
-rw-r--r--source/blender/editors/object/object_intern.h2
-rw-r--r--source/blender/editors/object/object_lattice.c198
-rw-r--r--source/blender/editors/object/object_modifier.c427
-rw-r--r--source/blender/editors/object/object_ops.c42
-rw-r--r--source/blender/editors/object/object_relations.c839
-rw-r--r--source/blender/editors/object/object_select.c321
-rw-r--r--source/blender/editors/object/object_shapekey.c170
-rw-r--r--source/blender/editors/object/object_transform.c287
-rw-r--r--source/blender/editors/object/object_vgroup.c907
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c3
-rw-r--r--source/blender/editors/physics/particle_edit.c238
-rw-r--r--source/blender/editors/physics/particle_object.c34
-rw-r--r--source/blender/editors/physics/physics_fluid.c73
-rw-r--r--source/blender/editors/render/render_opengl.c4
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/screen/area.c120
-rw-r--r--source/blender/editors/screen/glutil.c65
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c11
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
-rw-r--r--source/blender/editors/sound/sound_ops.c19
-rw-r--r--source/blender/editors/space_action/action_edit.c38
-rw-r--r--source/blender/editors/space_action/action_select.c14
-rw-r--r--source/blender/editors/space_action/space_action.c14
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c4
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c12
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c6
-rw-r--r--source/blender/editors/space_clip/clip_draw.c5
-rw-r--r--source/blender/editors/space_clip/clip_editor.c57
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c58
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c10
-rw-r--r--source/blender/editors/space_clip/clip_intern.h5
-rw-r--r--source/blender/editors/space_clip/clip_ops.c6
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c8
-rw-r--r--source/blender/editors/space_clip/clip_utils.c60
-rw-r--r--source/blender/editors/space_clip/space_clip.c221
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c82
-rw-r--r--source/blender/editors/space_file/file_draw.c22
-rw-r--r--source/blender/editors/space_file/file_intern.h2
-rw-r--r--source/blender/editors/space_file/file_ops.c13
-rw-r--r--source/blender/editors/space_file/file_panels.c2
-rw-r--r--source/blender/editors/space_file/filelist.c22
-rw-r--r--source/blender/editors/space_file/filesel.c3
-rw-r--r--source/blender/editors/space_file/fsmenu.c25
-rw-r--r--source/blender/editors/space_file/space_file.c20
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c10
-rw-r--r--source/blender/editors/space_graph/graph_edit.c52
-rw-r--r--source/blender/editors/space_graph/graph_select.c14
-rw-r--r--source/blender/editors/space_graph/graph_utils.c8
-rw-r--r--source/blender/editors/space_graph/space_graph.c101
-rw-r--r--source/blender/editors/space_image/image_draw.c61
-rw-r--r--source/blender/editors/space_image/image_ops.c7
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/info_stats.c2
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c5
-rw-r--r--source/blender/editors/space_logic/logic_ops.c2
-rw-r--r--source/blender/editors/space_logic/logic_window.c254
-rw-r--r--source/blender/editors/space_logic/space_logic.c4
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c8
-rw-r--r--source/blender/editors/space_nla/nla_draw.c4
-rw-r--r--source/blender/editors/space_nla/nla_edit.c50
-rw-r--r--source/blender/editors/space_nla/nla_ops.c6
-rw-r--r--source/blender/editors/space_nla/nla_select.c10
-rw-r--r--source/blender/editors/space_nla/space_nla.c20
-rw-r--r--source/blender/editors/space_node/drawnode.c68
-rw-r--r--source/blender/editors/space_node/node_draw.c32
-rw-r--r--source/blender/editors/space_node/node_edit.c6
-rw-r--r--source/blender/editors/space_node/node_select.c2
-rw-r--r--source/blender/editors/space_node/node_templates.c13
-rw-r--r--source/blender/editors/space_node/space_node.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c52
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c16
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c18
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c16
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c14
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c21
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c24
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c1
-rw-r--r--source/blender/editors/space_text/space_text.c4
-rw-r--r--source/blender/editors/space_text/text_draw.c3
-rw-r--r--source/blender/editors/space_text/text_intern.h1
-rw-r--r--source/blender/editors/space_text/text_ops.c30
-rw-r--r--source/blender/editors/space_text/text_python.c14
-rw-r--r--source/blender/editors/space_time/space_time.c11
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c19
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c206
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c14
-rw-r--r--source/blender/editors/transform/transform.c343
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c13
-rw-r--r--source/blender/editors/transform/transform_conversions.c296
-rw-r--r--source/blender/editors/transform/transform_generics.c136
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c26
-rw-r--r--source/blender/editors/transform/transform_ops.c55
-rw-r--r--source/blender/editors/transform/transform_orientations.c20
-rw-r--r--source/blender/editors/transform/transform_snap.c266
-rw-r--r--source/blender/editors/util/crazyspace.c69
-rw-r--r--source/blender/editors/util/numinput.c3
-rw-r--r--source/blender/editors/util/undo.c15
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c34
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h18
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c302
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c2
189 files changed, 6940 insertions, 7513 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 01ab36133fd..b62222317bd 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -98,10 +98,10 @@
/* Draw Backdrop ---------------------------------- */
/* get backdrop color for top-level widgets (Scene and Object only) */
-static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
/* darker blue for top-level widgets */
- UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color);
+ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color);
}
/* backdrop for top-level widgets (Scene and Object only) */
@@ -124,10 +124,10 @@ 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 *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
/* lighter color than top-level widget */
- UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color);
+ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color);
}
/* backdrop for data expanders under top-level Scene/Object */
@@ -147,7 +147,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
}
/* get backdrop color for generic channels */
-static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float *color)
+static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
SpaceAction *saction = NULL;
@@ -183,12 +183,12 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
}
/* copy the colors over, transforming from bytes to floats */
- rgb_uchar_to_float(color, cp);
+ rgb_uchar_to_float(r_color, cp);
}
else {
// FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
int colOfs= 20 - 20*indent;
- UI_GetThemeColorShade3fv(TH_HEADER, colOfs, color);
+ UI_GetThemeColorShade3fv(TH_HEADER, colOfs, r_color);
}
}
@@ -291,7 +291,7 @@ static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
offset += 21;
}
/* materials and particles animdata */
- else if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
+ else if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
offset += 14;
/* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
@@ -374,13 +374,13 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle
/* Animation Summary ----------------------------------- */
/* get backdrop color for summary widget */
-static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
// FIXME: hardcoded color - same as the 'action' line in NLA
// reddish color
- color[0] = 0.8f;
- color[1] = 0.2f;
- color[2] = 0.0f;
+ r_color[0] = 0.8f;
+ r_color[1] = 0.2f;
+ r_color[2] = 0.0f;
}
/* backdrop for summary widget */
@@ -730,13 +730,13 @@ static bAnimChannelType ACF_OBJECT =
/* Group ------------------------------------------- */
/* get backdrop color for group widget */
-static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color)
+static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3])
{
/* highlight only for action group channels */
if (ale->flag & AGRP_ACTIVE)
- UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, color);
+ UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
else
- UI_GetThemeColorShade3fv(TH_GROUP, 20, color);
+ UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
}
/* backdrop for group widget */
@@ -1427,7 +1427,7 @@ static bAnimChannelType ACF_DSCAM=
static int acf_dscur_icon(bAnimListElem *ale)
{
Curve *cu= (Curve *)ale->data;
- short obtype= curve_type(cu);
+ short obtype= BKE_curve_type_get(cu);
switch (obtype) {
case OB_FONT:
@@ -2322,10 +2322,10 @@ static bAnimChannelType ACF_SHAPEKEY=
/* GPencil Datablock ------------------------------------------- */
/* get backdrop color for gpencil datablock widget */
-static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
/* these are ID-blocks, but not exactly standalone... */
- UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, color);
+ UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
}
// TODO: just get this from RNA?
@@ -2560,7 +2560,7 @@ bAnimChannelType *ANIM_channel_get_typeinfo (bAnimListElem *ale)
/* --------------------------- */
/* Print debug info string for the given channel */
-void ANIM_channel_debug_print_info (bAnimListElem *ale, short indent_level)
+void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
@@ -2592,7 +2592,7 @@ void ANIM_channel_debug_print_info (bAnimListElem *ale, short indent_level)
/* Check if some setting for a channel is enabled
* Returns: 1 = On, 0 = Off, -1 = Invalid
*/
-short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int setting)
+short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
@@ -2669,7 +2669,7 @@ short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int settin
* - setting: eAnimChannel_Settings
* - mode: eAnimChannels_SetFlag
*/
-void ANIM_channel_setting_set (bAnimContext *ac, bAnimListElem *ale, int setting, short mode)
+void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
@@ -2722,7 +2722,7 @@ void ANIM_channel_setting_set (bAnimContext *ac, bAnimListElem *ale, int setting
/* Draw the given channel */
// TODO: make this use UI controls for the buttons
-void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
+void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
View2D *v2d= &ac->ar->v2d;
@@ -3043,7 +3043,8 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
}
/* Draw a widget for some setting */
-static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting)
+static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf,
+ uiBlock *block, int xpos, int ypos, int setting)
{
short negflag, ptrsize /* , enabled */ /* UNUSED */, butType;
int flag, icon;
@@ -3150,7 +3151,7 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan
}
/* Draw UI widgets the given channel */
-void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
+void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
View2D *v2d= &ac->ar->v2d;
@@ -3222,7 +3223,8 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al
uiBlockSetEmboss(block, UI_EMBOSS);
- but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height, &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
+ but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height,
+ &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL);
uiButActiveOnly(C, block, but);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index fb6a65a585f..e3c1aacd7ac 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -69,7 +69,7 @@
/* Set the given animation-channel as the active one for the active context */
// TODO: extend for animdata types...
-void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type)
+void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -188,7 +188,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
* - test: check if deselecting instead of selecting
* - sel: eAnimChannels_SetFlag;
*/
-void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, short test, short sel)
+void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, short test, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -372,7 +372,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
* - setting: type of setting to set
* - on: whether the visibility setting has been enabled or disabled
*/
-void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on)
+void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on)
{
bAnimListElem *ale, *match=NULL;
int prevLevel=0, matchLevel=0;
@@ -504,7 +504,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
/* -------------------------- F-Curves ------------------------------------- */
/* Delete the given F-Curve from its AnimData block */
-void ANIM_fcurve_delete_from_animdata (bAnimContext *ac, AnimData *adt, FCurve *fcu)
+void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *fcu)
{
/* - if no AnimData, we've got nowhere to remove the F-Curve from
* (this doesn't guarantee that the F-Curve is in there, but at least we tried
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 3f0e1b1be14..b449c11ff7b 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -241,7 +241,7 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
/* ---------------- */
/* Main call to be exported to animation editors */
-void ANIM_sync_animchannels_to_data (const bContext *C)
+void ANIM_sync_animchannels_to_data(const bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index bab341ae70b..236b8d18b78 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -63,7 +63,7 @@
* - cfra: time in frames or seconds, consistent with the values shown by timecodes
*/
// TODO: have this in kernel instead under scene?
-void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short timecodes, float cfra)
+void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short timecodes, float cfra)
{
if (timecodes) {
int hours=0, minutes=0, seconds=0, frames=0;
@@ -212,7 +212,7 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
}
/* General call for drawing current frame indicator in animation editor */
-void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
+void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
Scene *scene= CTX_data_scene(C);
float vec[2];
@@ -248,7 +248,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
/* Note: 'Preview Range' tools are defined in anim_ops.c */
/* Draw preview range 'curtains' for highlighting where the animation data is */
-void ANIM_draw_previewrange (const bContext *C, View2D *v2d)
+void ANIM_draw_previewrange(const bContext *C, View2D *v2d)
{
Scene *scene= CTX_data_scene(C);
@@ -335,7 +335,7 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
* - restore = whether to map points back to non-mapped time
* - only_keys = whether to only adjust the location of the center point of beztriples
*/
-void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys)
+void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, short only_keys)
{
KeyframeEditData ked= {{NULL}};
KeyframeEditFunc map_cb;
@@ -361,7 +361,7 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s
/* UNITS CONVERSION MAPPING (required for drawing and editing keyframes) */
/* Get unit conversion factor for given ID + F-Curve */
-float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short restore)
+float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short restore)
{
/* sanity checks */
if (id && fcu && fcu->rna_path) {
@@ -415,7 +415,7 @@ static short bezt_unit_mapping_apply (KeyframeEditData *ked, BezTriple *bezt)
}
/* Apply/Unapply units conversions to keyframes */
-void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short flag)
+void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short flag)
{
KeyframeEditData ked;
KeyframeEditFunc sel_cb;
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index e5822c76fa1..cc3401da6c5 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -260,7 +260,7 @@ static short nlaedit_get_context (bAnimContext *ac, SpaceNla *snla)
* - AnimContext to write to is provided as pointer to var on stack so that we don't have
* allocation/freeing costs (which are not that avoidable with channels).
*/
-short ANIM_animdata_context_getdata (bAnimContext *ac)
+short ANIM_animdata_context_getdata(bAnimContext *ac)
{
SpaceLink *sl = ac->sl;
short ok= 0;
@@ -303,7 +303,7 @@ short ANIM_animdata_context_getdata (bAnimContext *ac)
* allocation/freeing costs (which are not that avoidable with channels).
* - Clears data and sets the information from Blender Context which is useful
*/
-short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
+short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -824,11 +824,14 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *own
/* ----------------------------------------- */
-/* 'Only Selected' selected data filtering
+/* 'Only Selected' selected data and/or 'Include Hidden' filtering
* NOTE: when this function returns true, the F-Curve is to be skipped
*/
-static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
+static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
{
+ /* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */
+ short skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN);
+
if (GS(owner_id->name) == ID_OB) {
Object *ob= (Object *)owner_id;
@@ -845,17 +848,22 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
/* check whether to continue or skip */
if ((pchan) && (pchan->bone)) {
/* if only visible channels, skip if bone not visible unless user wants channels from hidden data too */
- if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
+ if (skip_hidden) {
bArmature *arm= (bArmature *)ob->data;
+ /* skipping - not visible on currently visible layers */
if ((arm->layer & pchan->bone->layer) == 0)
return 1;
- // TODO: manually hidden using flags
+ /* skipping - is currently hidden */
+ if (pchan->bone->flag & BONE_HIDDEN_P)
+ return 1;
}
/* can only add this F-Curve if it is selected */
- if ((pchan->bone->flag & BONE_SELECTED) == 0)
- return 1;
+ if (ads->filterflag & ADS_FILTER_ONLYSEL) {
+ if ((pchan->bone->flag & BONE_SELECTED) == 0)
+ return 1;
+ }
}
}
}
@@ -874,14 +882,16 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
if (seq_name) MEM_freeN(seq_name);
/* can only add this F-Curve if it is selected */
- if (seq==NULL || (seq->flag & SELECT)==0)
- return 1;
+ if (ads->filterflag & ADS_FILTER_ONLYSEL) {
+ if ((seq == NULL) || (seq->flag & SELECT)==0)
+ return 1;
+ }
}
}
else if (GS(owner_id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)owner_id;
- /* check for selected nodes */
+ /* check for selected nodes */
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
bNode *node;
char *node_name;
@@ -892,8 +902,10 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
if (node_name) MEM_freeN(node_name);
/* can only add this F-Curve if it is selected */
- if ((node) && (node->flag & NODE_SELECT)==0)
- return 1;
+ if (ads->filterflag & ADS_FILTER_ONLYSEL) {
+ if ((node) && (node->flag & NODE_SELECT)==0)
+ return 1;
+ }
}
}
return 0;
@@ -940,17 +952,19 @@ static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGr
*/
for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
/* special exception for Pose-Channel/Sequence-Strip/Node Based F-Curves:
- * - the 'Only Selected' data filter should be applied to Pose-Channel data too, but those are
- * represented as F-Curves. The way the filter for objects worked was to be the first check
- * after 'normal' visibility, so this is done first here too...
+ * - the 'Only Selected' and 'Include Hidden' data filters should be applied to sub-ID data which
+ * can be independently selected/hidden, such as Pose-Channels, Sequence Strips, and Nodes.
+ * Since these checks were traditionally done as first check for objects, we do the same here
* - we currently use an 'approximate' method for getting these F-Curves that doesn't require
* carefully checking the entire path
* - this will also affect things like Drivers, and also works for Bone Constraints
*/
- if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) && (owner_id) ) {
- if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
- continue;
- }
+ if (ads && owner_id) {
+ if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN)==0) {
+ if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
+ continue;
+ }
+ }
/* only include if visible (Graph Editor check, not channels check) */
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
@@ -992,8 +1006,7 @@ static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve *
* 4) the fcu pointer is set to the F-Curve after the one we just added, so that we can keep going through
* the rest of the F-Curve list without an eternal loop. Back to step 2 :)
*/
- for (fcu=first; ( (fcu = animfilter_fcurve_next(ads, fcu, grp, filter_mode, owner_id)) ); fcu=fcu->next)
- {
+ for (fcu = first; ( (fcu = animfilter_fcurve_next(ads, fcu, grp, filter_mode, owner_id)) ); fcu = fcu->next) {
ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id);
}
@@ -2205,7 +2218,7 @@ static size_t animdata_filter_remove_duplis (ListBase *anim_data)
* will be placed for use.
* filter_mode: how should the data be filtered - bitmapping accessed flags
*/
-size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype)
+size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype)
{
size_t items = 0;
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 6f4d4c4a431..4be3f79060e 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -191,7 +191,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* used to determine the color of F-Curves with FCURVE_COLOR_AUTO_RAINBOW set */
//void fcurve_rainbow (unsigned int cur, unsigned int tot, float *out)
-void getcolor_fcurve_rainbow (int cur, int tot, float *out)
+void getcolor_fcurve_rainbow(int cur, int tot, float *out)
{
float hue, val, sat, fac;
int grouping;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 73dba91207f..2527cb7eb40 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -121,7 +121,7 @@ ListBase *ED_animcontext_get_markers(const bAnimContext *ac)
* < value: from the transform code, this is t->vec[0] (which is delta transform for grab/extend, and scale factor for scale)
* < side: (B/L/R) for 'extend' functionality, which side of current frame to use
*/
-int ED_markers_post_apply_transform (ListBase *markers, Scene *scene, int mode, float value, char side)
+int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, float value, char side)
{
TimeMarker *marker;
float cfra = (float)CFRA;
@@ -187,14 +187,14 @@ TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
}
/* Return the time of the marker that occurs on a frame closest to the given time */
-int ED_markers_find_nearest_marker_time (ListBase *markers, float x)
+int ED_markers_find_nearest_marker_time(ListBase *markers, float x)
{
TimeMarker *nearest= ED_markers_find_nearest_marker(markers, x);
return (nearest) ? (nearest->frame) : (int)floor(x + 0.5f);
}
-void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *last)
+void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *last)
{
TimeMarker *marker;
float min, max;
@@ -509,7 +509,7 @@ static int ed_markers_poll_markers_exist(bContext *C)
* exec() callback will be called instead in the appropriate places.
*/
static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt,
- int (*invoke_func)(bContext*,wmOperator*,wmEvent*))
+ int (*invoke_func)(bContext *, wmOperator *, wmEvent *))
{
ScrArea *sa = CTX_wm_area(C);
int retval = OPERATOR_PASS_THROUGH;
@@ -745,7 +745,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
float dx, fac;
char str[256];
- switch(evt->type) {
+ switch (evt->type) {
case ESCKEY:
ed_marker_move_cancel(C, op);
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 9c4f96ebe6d..a4bc0cc854c 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -66,7 +66,7 @@
#include "anim_intern.h"
/* called by WM */
-void free_anim_drivers_copybuf (void);
+void free_anim_drivers_copybuf(void);
/* ************************************************** */
/* Animation Data Validation */
@@ -135,7 +135,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 (ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
+short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -229,7 +229,7 @@ short ANIM_add_driver (ReportList *reports, ID *id, const char rna_path[], int a
/* Main Driver Management API calls:
* Remove the driver for the specified property on the given ID block (if available)
*/
-short ANIM_remove_driver (ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
AnimData *adt;
FCurve *fcu;
@@ -281,7 +281,7 @@ static FCurve *channeldriver_copypaste_buf = NULL;
/* This function frees any MEM_calloc'ed copy/paste buffer data */
// XXX find some header to put this in!
-void free_anim_drivers_copybuf (void)
+void free_anim_drivers_copybuf(void)
{
/* free the buffer F-Curve if it exists, as if it were just another F-Curve */
if (channeldriver_copypaste_buf)
@@ -290,7 +290,7 @@ void free_anim_drivers_copybuf (void)
}
/* Checks if there is a driver in the copy/paste buffer */
-short ANIM_driver_can_paste (void)
+short ANIM_driver_can_paste(void)
{
return (channeldriver_copypaste_buf != NULL);
}
@@ -300,7 +300,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 (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -347,7 +347,7 @@ short ANIM_copy_driver (ReportList *reports, ID *id, const char rna_path[], int
* 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 (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -512,7 +512,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_driver_button_add (wmOperatorType *ot)
+void ANIM_OT_driver_button_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Driver";
@@ -564,7 +564,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_driver_button_remove (wmOperatorType *ot)
+void ANIM_OT_driver_button_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Driver";
@@ -611,7 +611,7 @@ static int copy_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_copy_driver_button (wmOperatorType *ot)
+void ANIM_OT_copy_driver_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Driver";
@@ -655,7 +655,7 @@ static int paste_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_paste_driver_button (wmOperatorType *ot)
+void ANIM_OT_paste_driver_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Driver";
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index d5ec98da588..9b46729b489 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -625,7 +625,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
/* --------------- */
-void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
{
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *sub, *col;
@@ -769,7 +769,7 @@ static ListBase fmodifier_copypaste_buf = {NULL, NULL};
/* ---------- */
/* free the copy/paste buffer */
-void free_fmodifiers_copybuf (void)
+void free_fmodifiers_copybuf(void)
{
/* just free the whole buffer */
free_fmodifiers(&fmodifier_copypaste_buf);
@@ -779,7 +779,7 @@ void free_fmodifiers_copybuf (void)
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
* - active: only copy the active modifier
*/
-short ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, short active)
+short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active)
{
short ok = 1;
@@ -808,7 +808,7 @@ short ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, short active)
/* 'Paste' the F-Modifier(s) from the buffer to the specified list
* - replace: free all the existing modifiers to leave only the pasted ones
*/
-short ANIM_fmodifiers_paste_from_buf (ListBase *modifiers, short replace)
+short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace)
{
FModifier *fcm;
short ok = 0;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 0e0ff0defbb..cc5cb42a783 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -80,7 +80,7 @@
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
/* NOTE: this is exported to other modules that use the ActKeyColumns for finding keyframes */
-short compare_ak_cfraPtr (void *node, void *data)
+short compare_ak_cfraPtr(void *node, void *data)
{
ActKeyColumn *ak= (ActKeyColumn *)node;
float *cframe= data;
@@ -312,7 +312,7 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
/* Comparator callback used for ActKeyBlock and cframe float-value pointer */
/* NOTE: this is exported to other modules that use the ActKeyBlocks for finding long-keyframes */
-short compare_ab_cfraPtr (void *node, void *data)
+short compare_ab_cfraPtr(void *node, void *data)
{
ActKeyBlock *ab= (ActKeyBlock *)node;
float *cframe= data;
@@ -459,7 +459,7 @@ static void set_touched_actkeyblock (ActKeyBlock *ab)
/* --------- */
/* Checks if ActKeyBlock should exist... */
-short actkeyblock_is_valid (ActKeyBlock *ab, DLRBT_Tree *keys)
+short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
{
ActKeyColumn *ak;
short startCurves, endCurves, totCurves;
@@ -494,7 +494,7 @@ static const float _unit_diamond_shape[4][2] = {
};
/* draw a simple diamond shape with OpenGL */
-void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
+void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
{
static GLuint displist1=0;
static GLuint displist2=0;
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 831b8d21b01..c54f8c5bd25 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -282,7 +282,7 @@ typedef struct tSmooth_Bezt {
/* Use a weighted moving-means method to reduce intensity of fluctuations */
// TODO: introduce scaling factor for weighting falloff
-void smooth_fcurve (FCurve *fcu)
+void smooth_fcurve(FCurve *fcu)
{
BezTriple *bezt;
int i, x, totSel = 0;
@@ -380,7 +380,7 @@ typedef struct tempFrameValCache {
/* Evaluates the curves between each selected keyframe on each frame, and keys the value */
-void sample_fcurve (FCurve *fcu)
+void sample_fcurve(FCurve *fcu)
{
BezTriple *bezt, *start=NULL, *end=NULL;
tempFrameValCache *value_cache, *fp;
@@ -477,7 +477,7 @@ typedef struct tAnimCopybufItem {
/* This function frees any MEM_calloc'ed copy/paste buffer data */
// XXX find some header to put this in!
-void free_anim_copybuf (void)
+void free_anim_copybuf(void)
{
tAnimCopybufItem *aci, *acn;
@@ -506,7 +506,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 *ac, ListBase *anim_data)
{
bAnimListElem *ale;
Scene *scene= ac->scene;
@@ -760,8 +760,8 @@ EnumPropertyItem keyframe_paste_merge_items[] = {
/* This function pastes data from the keyframes copy/paste buffer
* > return status code is whether the method FAILED to do anything
*/
-short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
- const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
+short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
+ const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
{
bAnimListElem *ale;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 47972ca2c6f..0df68c3775c 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -86,7 +86,7 @@
/* Keyframing Setting Wrangling */
/* Get the active settings for keyframing settings from context (specifically the given scene) */
-short ANIM_get_keyframing_flags (Scene *scene, short incl_mode)
+short ANIM_get_keyframing_flags(Scene *scene, short incl_mode)
{
short flag = 0;
@@ -214,7 +214,7 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
* NOTE: any recalculate of the F-Curve that needs to be done will need to
* be done by the caller.
*/
-int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
+int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
{
int i= 0;
@@ -295,7 +295,7 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
* adding a new keyframe to a curve, when the keyframe doesn't exist anywhere else yet.
* It returns the index at which the keyframe was added.
*/
-int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
+int insert_vert_fcurve(FCurve *fcu, float x, float y, short flag)
{
BezTriple beztr= {{{0}}};
unsigned int oldTot = fcu->totvert;
@@ -759,7 +759,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
* the keyframe insertion. These include the 'visual' keyframing modes, quick refresh,
* and extra keyframe filtering.
*/
-short insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
+short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
{
float curval= 0.0f;
@@ -880,7 +880,7 @@ short insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA *
*
* index of -1 keys all array indices
*/
-short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag)
+short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
@@ -971,7 +971,7 @@ short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char gro
* The flag argument is used for special settings that alter the behavior of
* the keyframe deletion. These include the quick refresh options.
*/
-short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
+short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
{
AnimData *adt= BKE_animdata_from_id(id);
PointerRNA id_ptr, ptr;
@@ -1153,7 +1153,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keyframe_insert (wmOperatorType *ot)
+void ANIM_OT_keyframe_insert(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1214,7 +1214,7 @@ static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(
}
}
-void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
+void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1309,7 +1309,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keyframe_delete (wmOperatorType *ot)
+void ANIM_OT_keyframe_delete(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1353,8 +1353,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
// XXX more comprehensive tests will be needed
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object*, ob, selected_objects) {
ID *id= (ID *)ob;
FCurve *fcu, *fcn;
short success= 0;
@@ -1384,7 +1383,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
+void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframe";
@@ -1474,7 +1473,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyframe_insert_button (wmOperatorType *ot)
+void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Insert Keyframe (Buttons)";
@@ -1546,7 +1545,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyframe_delete_button (wmOperatorType *ot)
+void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframe (Buttons)";
@@ -1592,7 +1591,7 @@ int autokeyframe_cfra_can_key(Scene *scene, ID *id)
/* --------------- API/Per-Datablock Handling ------------------- */
/* Checks if some F-Curve has a keyframe for a given frame */
-short fcurve_frame_has_keyframe (FCurve *fcu, float frame, short filter)
+short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
{
/* quick sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
@@ -1705,7 +1704,7 @@ static short object_frame_has_keyframe (Object *ob, float frame, short filter)
/* --------------- API ------------------- */
/* Checks whether a keyframe exists for the given ID-block one the given frame */
-short id_frame_has_keyframe (ID *id, float frame, short filter)
+short id_frame_has_keyframe(ID *id, float frame, short filter)
{
/* sanity checks */
if (id == NULL)
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index f66aa31f3f4..f9c4082e429 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -137,7 +137,7 @@ static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_add (wmOperatorType *ot)
+void ANIM_OT_keying_set_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Empty Keying Set";
@@ -184,7 +184,7 @@ static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_remove (wmOperatorType *ot)
+void ANIM_OT_keying_set_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Active Keying Set";
@@ -227,7 +227,7 @@ static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_path_add (wmOperatorType *ot)
+void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Empty Keying Set Path";
@@ -270,7 +270,7 @@ static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_path_remove (wmOperatorType *ot)
+void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Active Keying Set Path";
@@ -368,7 +368,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyingset_button_add (wmOperatorType *ot)
+void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add to Keying Set";
@@ -447,7 +447,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
+void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove from Keying Set";
@@ -494,7 +494,7 @@ static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_active_set (wmOperatorType *ot)
+void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -571,7 +571,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 (KeyingSetInfo *ksi)
+void ANIM_keyingset_info_register(KeyingSetInfo *ksi)
{
KeyingSet *ks;
@@ -591,7 +591,7 @@ void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
}
/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
-void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
+void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
{
KeyingSet *ks, *ksn;
@@ -620,7 +620,7 @@ void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
/* --------------- */
-void ANIM_keyingset_infos_exit (void)
+void ANIM_keyingset_infos_exit(void)
{
KeyingSetInfo *ksi, *next;
@@ -662,7 +662,7 @@ KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
}
/* Get the index of the Keying Set provided, for the given Scene */
-int ANIM_scene_get_keyingset_index (Scene *scene, KeyingSet *ks)
+int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
{
int index;
@@ -780,7 +780,7 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
/* Polling API ----------------------------------------------- */
/* Check if KeyingSet can be used in the current context */
-short ANIM_keyingset_context_ok_poll (bContext *C, KeyingSet *ks)
+short ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
{
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo);
@@ -824,7 +824,7 @@ static void RKS_ITER_overrides_list (KeyingSetInfo *ksi, bContext *C, KeyingSet
}
/* Add new data source for relative Keying Sets */
-void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *srna, void *data)
+void ANIM_relative_keyingset_add_source(ListBase *dsources, ID *id, StructRNA *srna, void *data)
{
tRKS_DSource *ds;
@@ -857,7 +857,7 @@ void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *
*
* Returns 0 if succeeded, otherwise an error code: eModifyKey_Returns
*/
-short ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks)
+short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
{
/* sanity check */
if (ks == NULL)
@@ -905,7 +905,7 @@ short ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks)
* by the KeyingSet. This takes into account many of the different combinations of using KeyingSets.
* Returns the number of channels that keyframes were added to
*/
-int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
+int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
{
Scene *scene= CTX_data_scene(C);
ReportList *reports = CTX_wm_reports(C);
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 13239f87e65..72d261ec187 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -63,6 +63,7 @@ void ARMATURE_OT_select_all(struct wmOperatorType *ot);
void ARMATURE_OT_select_inverse(struct wmOperatorType *ot);
void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot);
void ARMATURE_OT_select_linked(struct wmOperatorType *ot);
+void ARMATURE_OT_select_similar(struct wmOperatorType *ot);
void ARMATURE_OT_delete(struct wmOperatorType *ot);
void ARMATURE_OT_duplicate(struct wmOperatorType *ot);
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 21b97188522..aeecbc1fd28 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -69,6 +69,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_select_inverse);
WM_operatortype_append(ARMATURE_OT_select_hierarchy);
WM_operatortype_append(ARMATURE_OT_select_linked);
+ WM_operatortype_append(ARMATURE_OT_select_similar);
WM_operatortype_append(ARMATURE_OT_delete);
WM_operatortype_append(ARMATURE_OT_duplicate);
@@ -261,6 +262,8 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ WM_keymap_add_item(keymap, "ARMATURE_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
+
WM_keymap_add_item(keymap, "ARMATURE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_delete", XKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index cc3d0c6e184..e983b89e3d8 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -42,6 +42,7 @@
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
@@ -534,7 +535,7 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4])
/* exported for use in editors/object/ */
/* 0 == do center, 1 == center new, 2 == center cursor */
-void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermode, int around)
+void docenter_armature(Scene *scene, Object *ob, float cursor[3], int centermode, int around)
{
Object *obedit= scene->obedit; // XXX get from context
EditBone *ebone;
@@ -610,7 +611,7 @@ static int editbone_unique_check(void *arg, const char *name)
return dupli && dupli != data->bone;
}
-void unique_editbone_name (ListBase *edbo, char *name, EditBone *bone)
+void unique_editbone_name(ListBase *edbo, char *name, EditBone *bone)
{
struct {ListBase *lb; void *bone;} data;
data.lb= edbo;
@@ -680,7 +681,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
* 2. remove this from the 'visual' y-rotation
*/
{
- float premat[3][3], imat[3][3],pmat[3][3], tmat[3][3];
+ float premat[3][3], imat[3][3], pmat[3][3], tmat[3][3];
float delta[3], eul[3];
/* obtain new auto y-rotation */
@@ -693,7 +694,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
/* remove auto from visual and get euler rotation */
mul_m3_m3m3(tmat, imat, pmat);
- mat3_to_eul( eul,tmat);
+ mat3_to_eul(eul, tmat);
/* just use this euler-y as new roll value */
curbone->roll= eul[1];
@@ -726,7 +727,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_armature_apply (wmOperatorType *ot)
+void POSE_OT_armature_apply(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Pose as Rest Pose";
@@ -755,8 +756,7 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
*
* TODO, loop over children before parents if multiple bones
* at once are to be predictable*/
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
float delta_mat[4][4];
/* chan_mat already contains the delta transform from rest pose to pose-mode pose
@@ -777,7 +777,7 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
return OPERATOR_FINISHED;
}
-void POSE_OT_visual_transform_apply (wmOperatorType *ot)
+void POSE_OT_visual_transform_apply(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Visual Transform to Pose";
@@ -922,7 +922,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op))
pose= ob->pose;
ob->mode &= ~OB_MODE_POSE;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
if ((base->object->type==OB_ARMATURE) && (base->object!=ob)) {
bArmature *curarm= base->object->data;
@@ -1193,7 +1193,7 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
/* 1) only edit-base selected */
// TODO: use context iterators for this?
- CTX_DATA_BEGIN(C, Base *, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (base->object==obedit) base->flag |= 1;
else base->flag &= ~1;
}
@@ -1240,7 +1240,7 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_separate (wmOperatorType *ot)
+void ARMATURE_OT_separate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Separate Bones";
@@ -2286,7 +2286,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
View3D *v3d;
bArmature *arm;
EditBone *ebone, *newbone, *flipbone;
- float *curs, mat[3][3],imat[3][3];
+ float *curs, mat[3][3], imat[3][3];
int a, to_root= 0;
Object *obedit;
Scene *scene;
@@ -2458,8 +2458,7 @@ void preEditBoneDuplicate(ListBase *editbones)
EditBone *eBone;
/* clear temp */
- for (eBone = editbones->first; eBone; eBone = eBone->next)
- {
+ for (eBone = editbones->first; eBone; eBone = eBone->next) {
eBone->temp = NULL;
}
}
@@ -2817,8 +2816,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* loop over all bones, and only consider if visible */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
if (!(ebone->flag & BONE_CONNECTED) && (ebone->flag & BONE_ROOTSEL))
fill_add_joint(ebone, 0, &points);
if (ebone->flag & BONE_TIPSEL)
@@ -2947,7 +2945,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_fill (wmOperatorType *ot)
+void ARMATURE_OT_fill(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Fill Between Joints";
@@ -3126,7 +3124,7 @@ static int armature_merge_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_merge (wmOperatorType *ot)
+void ARMATURE_OT_merge(wmOperatorType *ot)
{
static EnumPropertyItem merge_types[] = {
{1, "WITHIN_CHAIN", 0, "Within Chains", ""},
@@ -3460,7 +3458,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "name", name);
- copy_v3_v3(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C)));
+ copy_v3_v3(curs, give_cursor(CTX_data_scene(C), CTX_wm_view3d(C)));
/* Get inverse point for head and orientation for tail */
invert_m4_m4(obedit->imat, obedit->obmat);
@@ -3531,8 +3529,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
/* loop over all editable bones */
// XXX the old code did this in reverse order though!
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
for (i=numcuts+1; i>1; i--) {
/* compute cut ratio first */
float cutratio= 1.0f / (float)i;
@@ -3820,7 +3817,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
*/
/* parent selected bones to the active one */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ELEM(ebone, actbone, actmirb) == 0) {
if (ebone->flag & BONE_SELECTED)
bone_connect_to_new_parent(arm->edbo, ebone, actbone, val);
@@ -3845,7 +3842,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
uiLayout *layout= uiPupMenuLayout(pup);
int allchildbones = 0;
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ebone != actbone) {
if (ebone->parent != actbone) allchildbones= 1;
}
@@ -3904,7 +3901,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op)
bArmature *arm= (bArmature *)ob->data;
int val = RNA_enum_get(op->ptr, "type");
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
editbone_clear_parent(ebone, val);
}
CTX_DATA_END;
@@ -3940,7 +3937,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
/* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
/* select bone */
@@ -3982,7 +3979,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
}
/* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
switch (action) {
@@ -4031,6 +4028,191 @@ void ARMATURE_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
+enum {
+ SIMEDBONE_LENGTH = 1,
+ SIMEDBONE_DIRECTION,
+ SIMEDBONE_PREFIX,
+ SIMEDBONE_SUFFIX,
+ SIMEDBONE_LAYER
+};
+
+static EnumPropertyItem prop_similar_types[] = {
+ {SIMEDBONE_LENGTH, "LENGTH", 0, "Length", ""},
+ {SIMEDBONE_DIRECTION, "DIRECTION", 0, "Direction (Y axis)", ""},
+ {SIMEDBONE_PREFIX, "PREFIX", 0, "Prefix", ""},
+ {SIMEDBONE_SUFFIX, "SUFFIX", 0, "Suffix", ""},
+ {SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+/* could be used in more places */
+static void ED_armature_edit_bone_select(EditBone *ebone)
+{
+ BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0);
+ ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+
+ if ((ebone->flag & BONE_CONNECTED) && (ebone->parent != NULL)) {
+ ebone->parent->flag |= BONE_TIPSEL;
+ }
+}
+
+static void select_similar_length(bArmature *arm, EditBone *ebone_act, const float thresh)
+{
+ EditBone *ebone;
+
+ /* thresh is always relative to current length */
+ const float len_min = ebone_act->length / (1.0f + thresh);
+ const float len_max = ebone_act->length * (1.0f + thresh);
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ if ((ebone->length >= len_min) &&
+ (ebone->length <= len_max))
+ {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const float thresh)
+{
+ EditBone *ebone;
+ float dir_act[3];
+ sub_v3_v3v3(dir_act, ebone_act->head, ebone_act->tail);
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ float dir[3];
+ sub_v3_v3v3(dir, ebone->head, ebone->tail);
+
+ if (angle_v3v3(dir_act, dir) / M_PI < thresh) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_layer(bArmature *arm, EditBone *ebone_act)
+{
+ EditBone *ebone;
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ if (ebone->layer & ebone_act->layer) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_prefix(bArmature *arm, EditBone *ebone_act)
+{
+ EditBone *ebone;
+
+ char body_tmp[MAX_VGROUP_NAME];
+ char prefix_act[MAX_VGROUP_NAME];
+
+ BKE_deform_split_prefix(ebone_act->name, prefix_act, body_tmp);
+
+ if (prefix_act[0] == '\0')
+ return;
+
+ /* Find matches */
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ char prefix_other[MAX_VGROUP_NAME];
+ BKE_deform_split_prefix(ebone->name, prefix_other, body_tmp);
+ if (!strcmp(prefix_act, prefix_other)) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_suffix(bArmature *arm, EditBone *ebone_act)
+{
+ EditBone *ebone;
+
+ char body_tmp[MAX_VGROUP_NAME];
+ char suffix_act[MAX_VGROUP_NAME];
+
+ BKE_deform_split_suffix(ebone_act->name, body_tmp, suffix_act);
+
+ if (suffix_act[0] == '\0')
+ return;
+
+ /* Find matches */
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ char suffix_other[MAX_VGROUP_NAME];
+ BKE_deform_split_suffix(ebone->name, body_tmp, suffix_other);
+ if (!strcmp(suffix_act, suffix_other)) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static int armature_select_similar_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ bArmature *arm = obedit->data;
+ EditBone *ebone_act = CTX_data_active_bone(C);
+
+ /* Get props */
+ int type = RNA_enum_get(op->ptr, "type");
+ float thresh = RNA_float_get(op->ptr, "threshold");
+
+ /* Check for active bone */
+ if (ebone_act == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Operation requires an Active Bone");
+ return OPERATOR_CANCELLED;
+ }
+
+ switch (type) {
+ case SIMEDBONE_LENGTH:
+ select_similar_length(arm, ebone_act, thresh);
+ break;
+ case SIMEDBONE_DIRECTION:
+ select_similar_direction(arm, ebone_act, thresh);
+ break;
+ case SIMEDBONE_PREFIX:
+ select_similar_prefix(arm, ebone_act);
+ break;
+ case SIMEDBONE_SUFFIX:
+ select_similar_suffix(arm, ebone_act);
+ break;
+ case SIMEDBONE_LAYER:
+ select_similar_layer(arm, ebone_act);
+ break;
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_select_similar(wmOperatorType *ot) {
+
+ /* identifiers */
+ ot->name = "Select Similar";
+ ot->idname = "ARMATURE_OT_select_similar";
+
+ /* callback functions */
+ ot->invoke = WM_menu_invoke;
+ ot->exec = armature_select_similar_exec;
+ ot->poll = ED_operator_editarmature;
+ ot->description = "Select similar bones by property types";
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_similar_types, 0, "Type", "");
+ RNA_def_float(ot->srna, "threshold", 0.1f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
+}
+
/* ********************* select hierarchy operator ************** */
static int armature_select_hierarchy_exec(bContext *C, wmOperator *op)
@@ -4216,7 +4398,7 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
*/
/* align selected bones to the active one */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ELEM(ebone, actbone, actmirb) == 0) {
if (ebone->flag & BONE_SELECTED)
bone_align_to_bone(arm->edbo, ebone, actbone);
@@ -4349,7 +4531,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
* test==2: only clear active tag
* test==3: swap select (no test / inverse selection status of all independently)
*/
-void ED_pose_deselectall (Object *ob, int test)
+void ED_pose_deselectall(Object *ob, int test)
{
bArmature *arm= ob->data;
bPoseChannel *pchan;
@@ -4444,7 +4626,7 @@ static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
* If such a vertex group aleady exist the routine exits.
*/
if (!(bone->flag & BONE_NO_DEFORM)) {
- if (!defgroup_find_name(ob,bone->name)) {
+ if (!defgroup_find_name(ob, bone->name)) {
ED_vgroup_add_name(ob, bone->name);
return 1;
}
@@ -4832,7 +5014,7 @@ static void pchan_clear_rot(bPoseChannel *pchan)
quat_to_eul(oldeul, quat1);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle);
+ axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, pchan->rotAxis, pchan->rotAngle);
}
else {
copy_v3_v3(oldeul, pchan->eul);
@@ -4859,7 +5041,7 @@ static void pchan_clear_rot(bPoseChannel *pchan)
}
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT);
+ eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, eul, EULER_ORDER_DEFAULT);
}
else {
copy_v3_v3(pchan->eul, eul);
@@ -4905,8 +5087,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
}
/* only clear relevant transforms for selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* run provided clearing function */
clear_func(pchan);
@@ -5047,7 +5228,7 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
}
/* Set the flags */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* select pchan only if selectable, but deselect works always */
switch (action) {
case SEL_SELECT:
@@ -5099,7 +5280,7 @@ void POSE_OT_select_all(wmOperatorType *ot)
static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
- bPoseChannel *pchan,*parent;
+ bPoseChannel *pchan, *parent;
/* Determine if there is an active bone */
pchan=CTX_data_active_pose_bone(C);
@@ -5436,8 +5617,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions
ED_armature_bone_rename(arm, ebone->name, newname);
}
@@ -5452,7 +5632,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_flip_names (wmOperatorType *ot)
+void ARMATURE_OT_flip_names(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Names";
@@ -5481,8 +5661,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
BLI_strncpy(newname, ebone->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
ED_armature_bone_rename(arm, ebone->name, newname);
@@ -5498,7 +5677,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_autoside_names (wmOperatorType *ot)
+void ARMATURE_OT_autoside_names(wmOperatorType *ot)
{
static EnumPropertyItem axis_items[]= {
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
@@ -5686,7 +5865,7 @@ float arcLengthRatio(ReebArc *arc)
if (arc->bcount > 0) {
/* Add the embedding */
- for ( i = 1; i < arc->bcount; i++) {
+ for (i = 1; i < arc->bcount; i++) {
embedLength += len_v3v3(arc->buckets[i - 1].p, arc->buckets[i].p);
}
/* Add head and tail -> embedding vectors */
@@ -5744,8 +5923,8 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
/* Copy orientation from source */
copy_v3_v3(dst->loc, src->obmat[3]);
- mat4_to_eul( dst->rot,src->obmat);
- mat4_to_size( dst->size,src->obmat);
+ mat4_to_eul(dst->rot, src->obmat);
+ mat4_to_size(dst->size, src->obmat);
where_is_object(scene, obedit);
@@ -5800,7 +5979,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
/* Loop over subdivision methods */
for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) {
- switch(scene->toolsettings->skgen_subdivisions[i]) {
+ switch (scene->toolsettings->skgen_subdivisions[i]) {
case SKGEN_SUB_LENGTH:
lastBone = test_subdivideByLength(scene, obedit, arc, head, tail);
break;
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 37d095221c9..5b56f5fe7fe 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -52,8 +52,7 @@
void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3])
{
- if (no != NULL && !is_zero_v3(no))
- {
+ if (no != NULL && !is_zero_v3(no)) {
float normal[3];
copy_v3_v3(normal, no);
@@ -67,16 +66,14 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
{
int len = 2 + abs(end - start);
- if (len > 2)
- {
+ if (len > 2) {
float avg_t = 0.0f;
float s_t = 0.0f;
float s_xyz = 0.0f;
int i;
/* First pass, calculate average */
- for (i = start; i <= end; i++)
- {
+ for (i = start; i <= end; i++) {
float v[3];
IT_peek(iter, i);
@@ -89,8 +86,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
avg_t /= len;
/* Second pass, calculate s_xyz and s_t */
- for (i = start; i <= end; i++)
- {
+ for (i = start; i <= end; i++) {
float v[3], d[3];
float dt;
@@ -110,8 +106,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
return 1.0f - s_xyz / s_t;
}
- else
- {
+ else {
return 1.0f;
}
}
@@ -125,15 +120,13 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
float length_threshold;
int i;
- if (stroke_length == 0)
- {
+ if (stroke_length == 0) {
current_length = 0;
IT_peek(iter, start);
v1 = iter->p;
- for (i = start + 1; i <= end; i++)
- {
+ for (i = start + 1; i <= end; i++) {
IT_peek(iter, i);
v2 = iter->p;
@@ -154,8 +147,7 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
v1 = iter->p;
/* < and not <= because we don't care about end, it is P_EXACT anyway */
- for (i = start + 1; i < end; i++)
- {
+ for (i = start + 1; i < end; i++) {
IT_peek(iter, i);
v2 = iter->p;
@@ -183,8 +175,7 @@ int nextAdaptativeSubdivision(ToolSettings *toolsettings, BArcIterator *iter, in
IT_peek(iter, start);
start_p = iter->p;
- for (i = start + 2; i <= end; i++)
- {
+ for (i = start + 2; i <= end; i++) {
/* Calculate normal */
IT_peek(iter, i);
sub_v3_v3v3(n, iter->p, head);
@@ -206,8 +197,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
int i;
i = start + 1;
- while (i <= end)
- {
+ while (i <= end) {
float *vec0;
float *vec1;
@@ -218,10 +208,8 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
vec1 = iter->p;
/* If lengthLimit hits the current segment */
- if (len_v3v3(vec1, head) > lengthLimit)
- {
- if (same == 0)
- {
+ if (len_v3v3(vec1, head) > lengthLimit) {
+ if (same == 0) {
float dv[3], off[3];
float a, b, c, f;
@@ -260,8 +248,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
return i - 1; /* restart at lower bound */
}
- else
- {
+ else {
i++;
same = 0; // Reset same
}
@@ -286,16 +273,14 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
parent = ED_armature_edit_bone_add(arm, "Bone");
copy_v3_v3(parent->head, iter->p);
- if (iter->size > 0)
- {
+ if (iter->size > 0) {
parent->rad_head = iter->size * size_buffer;
}
normal = iter->no;
index = next_subdividion(toolsettings, iter, bone_start, end, parent->head, parent->tail);
- while (index != -1)
- {
+ while (index != -1) {
IT_peek(iter, index);
child = ED_armature_edit_bone_add(arm, "Bone");
@@ -303,8 +288,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
child->parent = parent;
child->flag |= BONE_CONNECTED;
- if (iter->size > 0)
- {
+ if (iter->size > 0) {
child->rad_head = iter->size * size_buffer;
parent->rad_tail = iter->size * size_buffer;
}
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index f554b7b1c50..77b035024a9 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -119,10 +119,8 @@ static int countEditBoneChildren(ListBase *list, EditBone *parent)
EditBone *ebone;
int count = 0;
- for (ebone = list->first; ebone; ebone = ebone->next)
- {
- if (ebone->parent == parent)
- {
+ for (ebone = list->first; ebone; ebone = ebone->next) {
+ if (ebone->parent == parent) {
count++;
}
}
@@ -134,12 +132,9 @@ static EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n)
{
EditBone *ebone;
- for (ebone = list->first; ebone; ebone = ebone->next)
- {
- if (ebone->parent == parent)
- {
- if (n == 0)
- {
+ for (ebone = list->first; ebone; ebone = ebone->next) {
+ if (ebone->parent == parent) {
+ if (n == 0) {
return ebone;
}
n--;
@@ -175,23 +170,19 @@ static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float q
normalize_v3(x_axis);
normalize_v3(z_axis);
- if (dot_v3v3(new_up_axis, x_axis) < 0)
- {
+ if (dot_v3v3(new_up_axis, x_axis) < 0) {
negate_v3(x_axis);
}
- if (dot_v3v3(new_up_axis, z_axis) < 0)
- {
+ if (dot_v3v3(new_up_axis, z_axis) < 0) {
negate_v3(z_axis);
}
- if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis))
- {
+ if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis)) {
rotation_between_vecs_to_quat(qroll, new_up_axis, x_axis); /* set roll rotation quat */
return ED_rollBoneToVector(bone, x_axis, FALSE);
}
- else
- {
+ else {
rotation_between_vecs_to_quat(qroll, new_up_axis, z_axis); /* set roll rotation quat */
return ED_rollBoneToVector(bone, z_axis, FALSE);
}
@@ -199,26 +190,21 @@ static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float q
static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3])
{
- if (previous == NULL)
- {
+ if (previous == NULL) {
/* default to up_axis if no previous */
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
- else
- {
+ else {
float new_up_axis[3];
float vec_first[3], vec_second[3], normal[3];
- if (previous->bone)
- {
+ if (previous->bone) {
sub_v3_v3v3(vec_first, previous->bone->tail, previous->bone->head);
}
- else if (previous->prev->bone)
- {
+ else if (previous->prev->bone) {
sub_v3_v3v3(vec_first, edge->bone->head, previous->prev->bone->tail);
}
- else
- {
+ else {
/* default to up_axis if first bone in the chain is an offset */
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
@@ -274,19 +260,16 @@ void RIG_freeRigGraph(BGraph *rg)
BLI_destroy_worker(rigg->worker);
#endif
- if (rigg->link_mesh)
- {
+ if (rigg->link_mesh) {
REEB_freeGraph(rigg->link_mesh);
}
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RIG_freeRigArc(arc);
}
BLI_freelistN(&rg->arcs);
- for (node = rg->nodes.first; node; node = node->next)
- {
+ for (node = rg->nodes.first; node; node = node->next) {
BLI_freeNode(rg, (BNode*)node);
}
BLI_freelistN(&rg->nodes);
@@ -296,8 +279,7 @@ void RIG_freeRigGraph(BGraph *rg)
BLI_ghash_free(rigg->bones_map, NULL, NULL);
BLI_ghash_free(rigg->controls_map, NULL, NULL);
- if (rigg->flag & RIG_FREE_BONELIST)
- {
+ if (rigg->flag & RIG_FREE_BONELIST) {
BLI_freelistN(rigg->editbones);
MEM_freeN(rigg->editbones);
}
@@ -409,12 +391,10 @@ static void RIG_appendEdgeToArc(RigArc *arc, RigEdge *edge)
{
BLI_addtail(&arc->edges, edge);
- if (edge->prev == NULL)
- {
+ if (edge->prev == NULL) {
copy_v3_v3(edge->head, arc->head->p);
}
- else
- {
+ else {
RigEdge *last_edge = edge->prev;
copy_v3_v3(edge->head, last_edge->tail);
RIG_calculateEdgeAngles(last_edge, edge);
@@ -436,8 +416,7 @@ static void RIG_addEdgeToArc(RigArc *arc, float tail[3], EditBone *bone)
copy_v3_v3(edge->tail, tail);
edge->bone = bone;
- if (bone)
- {
+ if (bone) {
getEditBoneRollUpAxis(bone, bone->roll, edge->up_axis);
}
@@ -449,28 +428,22 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo
{
int i, j;
- for (i = 0, j = 0; i < (MAXBONENAME-1) && j < (MAXBONENAME-1) && template_name[i] != '\0'; i++)
- {
- if (template_name[i] == '&')
- {
- if (template_name[i+1] == 'S' || template_name[i+1] == 's')
- {
+ for (i = 0, j = 0; i < (MAXBONENAME-1) && j < (MAXBONENAME-1) && template_name[i] != '\0'; i++) {
+ if (template_name[i] == '&') {
+ if (template_name[i+1] == 'S' || template_name[i+1] == 's') {
j += sprintf(name + j, "%s", side_string);
i++;
}
- else if (template_name[i+1] == 'N' || template_name[i+1] == 'n')
- {
+ else if (template_name[i+1] == 'N' || template_name[i+1] == 'n') {
j += sprintf(name + j, "%s", num_string);
i++;
}
- else
- {
+ else {
name[j] = template_name[i];
j++;
}
}
- else
- {
+ else {
name[j] = template_name[i];
j++;
}
@@ -524,8 +497,7 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *
arc->count = src_arc->count;
- for (src_edge = src_arc->edges.first; src_edge; src_edge = src_edge->next)
- {
+ for (src_edge = src_arc->edges.first; src_edge; src_edge = src_edge->next) {
RigEdge *edge;
edge = MEM_callocN(sizeof(RigEdge), "rig edge");
@@ -538,8 +510,7 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *
edge->angle = src_edge->angle;
edge->up_angle = src_edge->up_angle;
- if (src_edge->bone != NULL)
- {
+ if (src_edge->bone != NULL) {
char name[MAXBONENAME];
renameTemplateBone(name, src_edge->bone->name, rg->editbones, side_string, num_string);
edge->bone = duplicateEditBoneObjects(src_edge->bone, name, rg->editbones, src_rg->ob, rg->ob);
@@ -572,8 +543,7 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
preEditBoneDuplicate(src->editbones); /* prime bones for duplication */
/* Clone nodes */
- for (node = src->nodes.first; node; node = node->next)
- {
+ for (node = src->nodes.first; node; node = node->next) {
RigNode *cloned_node = newRigNode(rg, node->p);
BLI_ghash_insert(ptr_hash, node, cloned_node);
}
@@ -581,40 +551,32 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
rg->head = BLI_ghash_lookup(ptr_hash, src->head);
/* Clone arcs */
- for (arc = src->arcs.first; arc; arc = arc->next)
- {
+ for (arc = src->arcs.first; arc; arc = arc->next) {
cloneArc(rg, src, arc, ptr_hash, side_string, num_string);
}
/* Clone controls */
- for (ctrl = src->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = src->controls.first; ctrl; ctrl = ctrl->next) {
cloneControl(rg, src, ctrl, ptr_hash, side_string, num_string);
}
/* Relink bones properly */
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
- if (edge->bone != NULL)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
+ if (edge->bone != NULL) {
EditBone *bone;
updateDuplicateSubtargetObjects(edge->bone, src->editbones, src->ob, rg->ob);
- if (edge->bone->parent)
- {
+ if (edge->bone->parent) {
bone = BLI_ghash_lookup(ptr_hash, edge->bone->parent);
- if (bone != NULL)
- {
+ if (bone != NULL) {
edge->bone->parent = bone;
}
- else
- {
+ else {
/* disconnect since parent isn't cloned
* this will only happen when cloning from selected bones
* */
@@ -625,22 +587,18 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
}
}
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
EditBone *bone;
updateDuplicateSubtargetObjects(ctrl->bone, src->editbones, src->ob, rg->ob);
- if (ctrl->bone->parent)
- {
+ if (ctrl->bone->parent) {
bone = BLI_ghash_lookup(ptr_hash, ctrl->bone->parent);
- if (bone != NULL)
- {
+ if (bone != NULL) {
ctrl->bone->parent = bone;
}
- else
- {
+ else {
/* disconnect since parent isn't cloned
* this will only happen when cloning from selected bones
* */
@@ -672,8 +630,7 @@ static void RIG_calculateEdgeAngles(RigEdge *edge_first, RigEdge *edge_second)
edge_first->angle = angle_normalized_v3v3(vec_first, vec_second);
- if (edge_second->bone != NULL)
- {
+ if (edge_second->bone != NULL) {
float normal[3];
cross_v3_v3v3(normal, vec_first, vec_second);
@@ -699,16 +656,14 @@ static void RIG_addControlBone(RigGraph *rg, EditBone *bone)
static int RIG_parentControl(RigControl *ctrl, EditBone *link)
{
- if (link)
- {
+ if (link) {
float offset[3];
int flag = 0;
sub_v3_v3v3(offset, ctrl->bone->head, link->head);
/* if root matches, check for direction too */
- if (dot_v3v3(offset, offset) < 0.0001f)
- {
+ if (dot_v3v3(offset, offset) < 0.0001f) {
float vbone[3], vparent[3];
flag |= RIG_CTRL_FIT_ROOT;
@@ -717,45 +672,38 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link)
sub_v3_v3v3(vparent, link->tail, link->head);
/* test for opposite direction */
- if (dot_v3v3(vbone, vparent) > 0)
- {
+ if (dot_v3v3(vbone, vparent) > 0) {
float nor[3];
float len;
cross_v3_v3v3(nor, vbone, vparent);
len = dot_v3v3(nor, nor);
- if (len < 0.0001f)
- {
+ if (len < 0.0001f) {
flag |= RIG_CTRL_FIT_BONE;
}
}
}
/* Bail out if old one is automatically better */
- if (flag < ctrl->flag)
- {
+ if (flag < ctrl->flag) {
return 0;
}
/* if there's already a link
* overwrite only if new link is higher in the chain */
- if (ctrl->link && flag == ctrl->flag)
- {
+ if (ctrl->link && flag == ctrl->flag) {
EditBone *bone = NULL;
- for (bone = ctrl->link; bone; bone = bone->parent)
- {
+ for (bone = ctrl->link; bone; bone = bone->parent) {
/* if link is in the chain, break and use that one */
- if (bone == link)
- {
+ if (bone == link) {
break;
}
}
/* not in chain, don't update link */
- if (bone == NULL)
- {
+ if (bone == NULL) {
return 0;
}
}
@@ -778,43 +726,34 @@ static void RIG_reconnectControlBones(RigGraph *rg)
int change = 1;
/* first pass, link to deform bones */
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
bPoseChannel *pchan;
bConstraint *con;
int found = 0;
/* DO SOME MAGIC HERE */
- for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next)
- {
- for (con= pchan->constraints.first; con; con= con->next)
- {
+ for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
/* constraint targets */
- if (cti && cti->get_constraint_targets)
- {
+ if (cti && cti->get_constraint_targets) {
int target_index;
cti->get_constraint_targets(con, &targets);
- for (target_index = 0, ct= targets.first; ct; target_index++, ct= ct->next)
- {
- if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0)
- {
+ for (target_index = 0, ct= targets.first; ct; target_index++, ct= ct->next) {
+ if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) {
/* SET bone link to bone corresponding to pchan */
EditBone *link = BLI_ghash_lookup(rg->bones_map, pchan->name);
/* Making sure bone is in this armature */
- if (link != NULL)
- {
+ if (link != NULL) {
/* for pole targets, link to parent bone instead, if possible */
- if (con->type == CONSTRAINT_TYPE_KINEMATIC && target_index == 1)
- {
- if (link->parent && BLI_ghash_haskey(rg->bones_map, link->parent->name))
- {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC && target_index == 1) {
+ if (link->parent && BLI_ghash_haskey(rg->bones_map, link->parent->name)) {
link = link->parent;
}
}
@@ -831,10 +770,8 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* if not found yet, check parent */
- if (found == 0)
- {
- if (ctrl->bone->parent)
- {
+ if (found == 0) {
+ if (ctrl->bone->parent) {
/* make sure parent is a deforming bone
* NULL if not
* */
@@ -849,24 +786,19 @@ static void RIG_reconnectControlBones(RigGraph *rg)
RigArc *best_arc = NULL;
EditBone *link = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
- if (edge->bone)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
+ if (edge->bone) {
int fit = 0;
fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001f;
fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001f;
- if (fit)
- {
+ if (fit) {
/* pick the bone on the arc with the lowest symmetry level
* means you connect control to the trunk of the skeleton */
- if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level)
- {
+ if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level) {
best_arc = arc;
link = edge->bone;
}
@@ -880,23 +812,18 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* if not found yet, check child */
- if (found == 0)
- {
+ if (found == 0) {
RigArc *arc;
RigArc *best_arc = NULL;
EditBone *link = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
- if (edge->bone && edge->bone->parent == ctrl->bone)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
+ if (edge->bone && edge->bone->parent == ctrl->bone) {
/* pick the bone on the arc with the lowest symmetry level
* means you connect control to the trunk of the skeleton */
- if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level)
- {
+ if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level) {
best_arc = arc;
link = edge->bone;
}
@@ -911,52 +838,42 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* second pass, make chains in control bones */
- while (change)
- {
+ while (change) {
change = 0;
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
/* if control is not linked yet */
- if (ctrl->link == NULL)
- {
+ if (ctrl->link == NULL) {
bPoseChannel *pchan;
bConstraint *con;
RigControl *ctrl_parent = NULL;
RigControl *ctrl_child;
int found = 0;
- if (ctrl->bone->parent)
- {
+ if (ctrl->bone->parent) {
ctrl_parent = BLI_ghash_lookup(rg->controls_map, ctrl->bone->parent->name);
}
/* check constraints first */
/* DO SOME MAGIC HERE */
- for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next)
- {
- for (con= pchan->constraints.first; con; con= con->next)
- {
+ for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
/* constraint targets */
- if (cti && cti->get_constraint_targets)
- {
+ if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
- for (ct= targets.first; ct; ct= ct->next)
- {
- if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0)
- {
+ for (ct= targets.first; ct; ct= ct->next) {
+ if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) {
/* SET bone link to ctrl corresponding to pchan */
RigControl *link = BLI_ghash_lookup(rg->controls_map, pchan->name);
/* if owner is a control bone, link with it */
- if (link && link->link)
- {
+ if (link && link->link) {
RIG_parentControl(ctrl, link->bone);
found = 1;
break;
@@ -970,22 +887,17 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
}
- if (found == 0)
- {
+ if (found == 0) {
/* check if parent is already linked */
- if (ctrl_parent && ctrl_parent->link)
- {
+ if (ctrl_parent && ctrl_parent->link) {
RIG_parentControl(ctrl, ctrl_parent->bone);
change = 1;
}
- else
- {
+ else {
/* check childs */
- for (ctrl_child = rg->controls.first; ctrl_child; ctrl_child = ctrl_child->next)
- {
+ for (ctrl_child = rg->controls.first; ctrl_child; ctrl_child = ctrl_child->next) {
/* if a child is linked, link to that one */
- if (ctrl_child->link && ctrl_child->bone->parent == ctrl->bone)
- {
+ if (ctrl_child->link && ctrl_child->bone->parent == ctrl->bone) {
RIG_parentControl(ctrl, ctrl_child->bone);
change = 1;
break;
@@ -998,31 +910,25 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* third pass, link control tails */
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
/* fit bone already means full match, so skip those */
- if ((ctrl->flag & RIG_CTRL_FIT_BONE) == 0)
- {
+ if ((ctrl->flag & RIG_CTRL_FIT_BONE) == 0) {
GHashIterator ghi;
/* look on deform bones first */
BLI_ghashIterator_init(&ghi, rg->bones_map);
- for ( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi))
- {
+ for ( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi)) {
EditBone *bone = (EditBone*)BLI_ghashIterator_getValue(&ghi);
/* don't link with parent */
- if (bone->parent != ctrl->bone)
- {
- if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01f)
- {
+ if (bone->parent != ctrl->bone) {
+ if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01f) {
ctrl->tail_mode = TL_HEAD;
ctrl->link_tail = bone;
break;
}
- else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01f)
- {
+ else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01f) {
ctrl->tail_mode = TL_TAIL;
ctrl->link_tail = bone;
break;
@@ -1031,8 +937,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* if we haven't found one yet, look in control bones */
- if (ctrl->tail_mode == TL_NONE)
- {
+ if (ctrl->tail_mode == TL_NONE) {
}
}
}
@@ -1046,21 +951,18 @@ static void RIG_joinArcs(RigGraph *rg, RigNode *node, RigArc *joined_arc1, RigAr
RigEdge *edge, *next_edge;
/* ignore cases where joint is at start or end */
- if (joined_arc1->head == joined_arc2->head || joined_arc1->tail == joined_arc2->tail)
- {
+ if (joined_arc1->head == joined_arc2->head || joined_arc1->tail == joined_arc2->tail) {
return;
}
/* swap arcs to make sure arc1 is before arc2 */
- if (joined_arc1->head == joined_arc2->tail)
- {
+ if (joined_arc1->head == joined_arc2->tail) {
RigArc *tmp = joined_arc1;
joined_arc1 = joined_arc2;
joined_arc2 = tmp;
}
- for (edge = joined_arc2->edges.first; edge; edge = next_edge)
- {
+ for (edge = joined_arc2->edges.first; edge; edge = next_edge) {
next_edge = edge->next;
RIG_appendEdgeToArc(joined_arc1, edge);
@@ -1079,24 +981,18 @@ static void RIG_removeNormalNodes(RigGraph *rg)
{
RigNode *node, *next_node;
- for (node = rg->nodes.first; node; node = next_node)
- {
+ for (node = rg->nodes.first; node; node = next_node) {
next_node = node->next;
- if (node->degree == 2)
- {
+ if (node->degree == 2) {
RigArc *arc, *joined_arc1 = NULL, *joined_arc2 = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head == node || arc->tail == node)
- {
- if (joined_arc1 == NULL)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head == node || arc->tail == node) {
+ if (joined_arc1 == NULL) {
joined_arc1 = arc;
}
- else
- {
+ else {
joined_arc2 = arc;
break;
}
@@ -1112,36 +1008,29 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
{
RigArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *first_edge, *last_edge;
first_edge = arc->edges.first;
last_edge = arc->edges.last;
- if (first_edge->bone == NULL)
- {
- if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001f)
- {
+ if (first_edge->bone == NULL) {
+ if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001f) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
}
- else if (arc->head->degree == 1)
- {
+ else if (arc->head->degree == 1) {
RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001f);
- if (new_node)
- {
+ if (new_node) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)arc, (BNode*)new_node, (BNode*)arc->head);
}
- else
- {
+ else {
RigEdge *next_edge = first_edge->next;
- if (next_edge)
- {
+ if (next_edge) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
@@ -1149,57 +1038,44 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
}
}
}
- else
- {
+ else {
/* check if all arc connected start with a null edge */
RigArc *other_arc;
- for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
- {
- if (other_arc != arc)
- {
+ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) {
+ if (other_arc != arc) {
RigEdge *test_edge;
- if (other_arc->head == arc->head)
- {
+ if (other_arc->head == arc->head) {
test_edge = other_arc->edges.first;
- if (test_edge->bone != NULL)
- {
+ if (test_edge->bone != NULL) {
break;
}
}
- else if (other_arc->tail == arc->head)
- {
+ else if (other_arc->tail == arc->head) {
test_edge = other_arc->edges.last;
- if (test_edge->bone != NULL)
- {
+ if (test_edge->bone != NULL) {
break;
}
}
}
}
- if (other_arc == NULL)
- {
+ if (other_arc == NULL) {
RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001);
- if (new_node)
- {
+ if (new_node) {
/* remove null edge in other arcs too */
- for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
- {
- if (other_arc != arc)
- {
+ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) {
+ if (other_arc != arc) {
RigEdge *test_edge;
- if (other_arc->head == arc->head)
- {
+ if (other_arc->head == arc->head) {
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)other_arc, (BNode*)new_node, (BNode*)other_arc->head);
test_edge = other_arc->edges.first;
BLI_remlink(&other_arc->edges, test_edge);
MEM_freeN(test_edge);
}
- else if (other_arc->tail == arc->head)
- {
+ else if (other_arc->tail == arc->head) {
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)other_arc, (BNode*)new_node, (BNode*)other_arc->tail);
test_edge = other_arc->edges.last;
BLI_remlink(&other_arc->edges, test_edge);
@@ -1212,31 +1088,25 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
MEM_freeN(first_edge);
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)arc, (BNode*)new_node, (BNode*)arc->head);
}
- else
- {
+ else {
RigEdge *next_edge = first_edge->next;
- if (next_edge)
- {
+ if (next_edge) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
copy_v3_v3(arc->head->p, next_edge->head);
/* remove null edge in other arcs too */
- for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
- {
- if (other_arc != arc)
- {
+ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) {
+ if (other_arc != arc) {
RigEdge *test_edge;
- if (other_arc->head == arc->head)
- {
+ if (other_arc->head == arc->head) {
test_edge = other_arc->edges.first;
BLI_remlink(&other_arc->edges, test_edge);
MEM_freeN(test_edge);
}
- else if (other_arc->tail == arc->head)
- {
+ else if (other_arc->tail == arc->head) {
test_edge = other_arc->edges.last;
BLI_remlink(&other_arc->edges, test_edge);
MEM_freeN(test_edge);
@@ -1249,19 +1119,15 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
}
}
- if (last_edge->bone == NULL)
- {
- if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001f)
- {
+ if (last_edge->bone == NULL) {
+ if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001f) {
BLI_remlink(&arc->edges, last_edge);
MEM_freeN(last_edge);
}
- else if (arc->tail->degree == 1)
- {
+ else if (arc->tail->degree == 1) {
RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, last_edge->head, 0.001f);
- if (new_node)
- {
+ if (new_node) {
RigEdge *previous_edge = last_edge->prev;
BLI_remlink(&arc->edges, last_edge);
@@ -1269,17 +1135,14 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)arc, (BNode*)new_node, (BNode*)arc->tail);
/* set previous angle to 0, since there's no following edges */
- if (previous_edge)
- {
+ if (previous_edge) {
previous_edge->angle = 0;
}
}
- else
- {
+ else {
RigEdge *previous_edge = last_edge->prev;
- if (previous_edge)
- {
+ if (previous_edge) {
BLI_remlink(&arc->edges, last_edge);
MEM_freeN(last_edge);
@@ -1298,32 +1161,25 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
RigArc *arc = NULL;
int contain_head = 0;
- for (bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0))
- {
+ for (bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0)) {
int nb_children;
- if (selected == 0 || (bone->flag & BONE_SELECTED))
- {
- if ((bone->flag & BONE_NO_DEFORM) == 0)
- {
+ if (selected == 0 || (bone->flag & BONE_SELECTED)) {
+ if ((bone->flag & BONE_NO_DEFORM) == 0) {
BLI_ghash_insert(rg->bones_map, bone->name, bone);
- if (arc == NULL)
- {
+ if (arc == NULL) {
arc = newRigArc(rg);
- if (starting_node == NULL)
- {
+ if (starting_node == NULL) {
starting_node = newRigNodeHead(rg, arc, root_bone->head);
}
- else
- {
+ else {
addRigNodeHead(rg, arc, starting_node);
}
}
- if (bone->parent && (bone->flag & BONE_CONNECTED) == 0)
- {
+ if (bone->parent && (bone->flag & BONE_CONNECTED) == 0) {
RIG_addEdgeToArc(arc, bone->head, NULL);
}
@@ -1331,34 +1187,28 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
last_bone = bone;
- if (strcmp(bone->name, "head") == 0)
- {
+ if (strcmp(bone->name, "head") == 0) {
contain_head = 1;
}
}
- else if ((bone->flag & BONE_EDITMODE_LOCKED) == 0) /* ignore locked bones */
- {
+ else if ((bone->flag & BONE_EDITMODE_LOCKED) == 0) { /* ignore locked bones */
RIG_addControlBone(rg, bone);
}
}
nb_children = countEditBoneChildren(list, bone);
- if (nb_children > 1)
- {
+ if (nb_children > 1) {
RigNode *end_node = NULL;
int i;
- if (arc != NULL)
- {
+ if (arc != NULL) {
end_node = newRigNodeTail(rg, arc, bone->tail);
}
- else
- {
+ else {
end_node = newRigNode(rg, bone->tail);
}
- for (i = 0; i < nb_children; i++)
- {
+ for (i = 0; i < nb_children; i++) {
root_bone = nextEditBoneChild(list, bone, i);
RIG_arcFromBoneChain(rg, list, root_bone, end_node, selected);
}
@@ -1369,13 +1219,11 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
}
/* If the loop exited without forking */
- if (arc != NULL && bone == NULL)
- {
+ if (arc != NULL && bone == NULL) {
newRigNodeTail(rg, arc, last_bone->tail);
}
- if (contain_head)
- {
+ if (contain_head) {
rg->head = arc->tail;
}
}
@@ -1383,32 +1231,26 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
/*******************************************************************************************************/
static void RIG_findHead(RigGraph *rg)
{
- if (rg->head == NULL)
- {
- if (BLI_countlist(&rg->arcs) == 1)
- {
+ if (rg->head == NULL) {
+ if (BLI_countlist(&rg->arcs) == 1) {
RigArc *arc = rg->arcs.first;
rg->head = (RigNode*)arc->head;
}
- else
- {
+ else {
RigArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge = arc->edges.last;
- if (edge->bone->flag & (BONE_TIPSEL|BONE_SELECTED))
- {
+ if (edge->bone->flag & (BONE_TIPSEL|BONE_SELECTED)) {
rg->head = arc->tail;
break;
}
}
}
- if (rg->head == NULL)
- {
+ if (rg->head == NULL) {
rg->head = rg->nodes.first;
}
}
@@ -1420,8 +1262,7 @@ static void RIG_printNode(RigNode *node, const char name[])
{
printf("%s %p %i <%0.3f, %0.3f, %0.3f>\n", name, (void *)node, node->degree, node->p[0], node->p[1], node->p[2]);
- if (node->symmetry_flag & SYM_TOPOLOGICAL)
- {
+ if (node->symmetry_flag & SYM_TOPOLOGICAL) {
if (node->symmetry_flag & SYM_AXIAL)
printf("Symmetry AXIAL\n");
else if (node->symmetry_flag & SYM_RADIAL)
@@ -1435,8 +1276,7 @@ void RIG_printArcBones(RigArc *arc)
{
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
if (edge->bone)
printf("%s ", edge->bone->name);
else
@@ -1465,17 +1305,14 @@ static void RIG_printLinkedCtrl(RigGraph *rg, EditBone *bone, int tabs)
char *s = indent;
int i;
- for (i = 0; i < tabs; i++)
- {
+ for (i = 0; i < tabs; i++) {
s[0] = '\t';
s++;
}
s[0] = 0;
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
- if (ctrl->link == bone)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
+ if (ctrl->link == bone) {
RIG_printCtrl(ctrl, indent);
RIG_printLinkedCtrl(rg, ctrl->bone, tabs + 1);
}
@@ -1488,13 +1325,11 @@ void RIG_printArc(RigGraph *rg, RigArc *arc)
RIG_printNode((RigNode*)arc->head, "head");
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
printf("\tinner joints %0.3f %0.3f %0.3f\n", edge->tail[0], edge->tail[1], edge->tail[2]);
printf("\t\tlength %f\n", edge->length);
printf("\t\tangle %f\n", edge->angle * 180 / M_PI);
- if (edge->bone)
- {
+ if (edge->bone) {
printf("\t\t%s\n", edge->bone->name);
RIG_printLinkedCtrl(rg, edge->bone, 3);
}
@@ -1509,18 +1344,15 @@ void RIG_printGraph(RigGraph *rg)
RigArc *arc;
printf("---- ARCS ----\n");
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RIG_printArc(rg, arc);
printf("\n");
}
- if (rg->head)
- {
+ if (rg->head) {
RIG_printNode(rg->head, "HEAD NODE:");
}
- else
- {
+ else {
printf("HEAD NODE: NONE\n");
}
}
@@ -1536,12 +1368,10 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
rg = newRigGraph();
- if (obedit == ob)
- {
+ if (obedit == ob) {
rg->editbones = ((bArmature *)obedit->data)->edbo;
}
- else
- {
+ else {
rg->editbones = MEM_callocN(sizeof(ListBase), "EditBones");
make_boneList(rg->editbones, &arm->bonebase, NULL, NULL);
rg->flag |= RIG_FREE_BONELIST;
@@ -1551,8 +1381,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
/* Do the rotations */
for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
- if (ebone->parent == NULL)
- {
+ if (ebone->parent == NULL) {
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 0);
}
}
@@ -1571,8 +1400,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
RIG_reconnectControlBones(rg); /* after symmetry, because we use levels to find best match */
- if (BLI_isGraphCyclic((BGraph*)rg))
- {
+ if (BLI_isGraphCyclic((BGraph*)rg)) {
printf("armature cyclic\n");
}
@@ -1588,12 +1416,10 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
rg = newRigGraph();
- if (obedit == ob)
- {
+ if (obedit == ob) {
rg->editbones = arm->edbo;
}
- else
- {
+ else {
rg->editbones = MEM_callocN(sizeof(ListBase), "EditBones");
make_boneList(rg->editbones, &arm->bonebase, NULL, NULL);
rg->flag |= RIG_FREE_BONELIST;
@@ -1603,8 +1429,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
/* Do the rotations */
for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
- if (ebone->parent == NULL)
- {
+ if (ebone->parent == NULL) {
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 1);
}
}
@@ -1623,8 +1448,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
RIG_reconnectControlBones(rg); /* after symmetry, because we use levels to find best match */
- if (BLI_isGraphCyclic((BGraph*)rg))
- {
+ if (BLI_isGraphCyclic((BGraph*)rg)) {
printf("armature cyclic\n");
}
@@ -1721,8 +1545,7 @@ static void repositionTailControl(RigGraph *rigg, RigControl *ctrl);
static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
{
- if ((ctrl->flag & RIG_CTRL_DONE) == RIG_CTRL_DONE)
- {
+ if ((ctrl->flag & RIG_CTRL_DONE) == RIG_CTRL_DONE) {
RigControl *ctrl_child;
#if 0
@@ -1737,17 +1560,14 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
#endif
/* if there was a tail link: apply link, recalc resize factor and qrot */
- if (ctrl->tail_mode != TL_NONE)
- {
+ if (ctrl->tail_mode != TL_NONE) {
float *tail_vec = NULL;
float v1[3], v2[3], qtail[4];
- if (ctrl->tail_mode == TL_TAIL)
- {
+ if (ctrl->tail_mode == TL_TAIL) {
tail_vec = ctrl->link_tail->tail;
}
- else if (ctrl->tail_mode == TL_HEAD)
- {
+ else if (ctrl->tail_mode == TL_HEAD) {
tail_vec = ctrl->link_tail->head;
}
@@ -1765,14 +1585,11 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
ctrl->bone->roll = rollBoneByQuat(ctrl->bone, ctrl->up_axis, ctrl->qrot);
/* Cascade to connected control bones */
- for (ctrl_child = rigg->controls.first; ctrl_child; ctrl_child = ctrl_child->next)
- {
- if (ctrl_child->link == ctrl->bone)
- {
+ for (ctrl_child = rigg->controls.first; ctrl_child; ctrl_child = ctrl_child->next) {
+ if (ctrl_child->link == ctrl->bone) {
repositionControl(rigg, ctrl_child, ctrl->bone->head, ctrl->bone->tail, ctrl->qrot, resize);
}
- if (ctrl_child->link_tail == ctrl->bone)
- {
+ if (ctrl_child->link_tail == ctrl->bone) {
repositionTailControl(rigg, ctrl_child);
}
}
@@ -1800,8 +1617,7 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f
copy_qt_qt(ctrl->qrot, qrot);
- if (ctrl->tail_mode == TL_NONE)
- {
+ if (ctrl->tail_mode == TL_NONE) {
sub_v3_v3v3(tail_offset, ctrl->tail, ctrl->head);
mul_v3_fl(tail_offset, resize);
mul_qt_v3(qrot, tail_offset);
@@ -1838,38 +1654,30 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec
copy_v3_v3(bone->head, vec0);
copy_v3_v3(bone->tail, vec1);
- if (!is_zero_v3(up_axis))
- {
+ if (!is_zero_v3(up_axis)) {
float qroll[4];
- if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_VIEW)
- {
+ if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_VIEW) {
bone->roll = rollBoneByQuatAligned(bone, edge->up_axis, qrot, qroll, up_axis);
}
- else if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT)
- {
+ else if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT) {
bone->roll = rollBoneByQuatJoint(edge, edge->prev, qrot, qroll, up_axis);
}
- else
- {
+ else {
unit_qt(qroll);
}
mul_qt_qtqt(qrot, qroll, qrot);
}
- else
- {
+ else {
bone->roll = rollBoneByQuat(bone, edge->up_axis, qrot);
}
- for (ctrl = rigg->controls.first; ctrl; ctrl = ctrl->next)
- {
- if (ctrl->link == bone)
- {
+ for (ctrl = rigg->controls.first; ctrl; ctrl = ctrl->next) {
+ if (ctrl->link == bone) {
repositionControl(rigg, ctrl, vec0, vec1, qrot, resize);
}
- if (ctrl->link_tail == bone)
- {
+ if (ctrl->link_tail == bone) {
repositionTailControl(rigg, ctrl);
}
}
@@ -1890,8 +1698,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
int nb_edges = 0;
- for (edge = iarc->edges.first; edge; edge = edge->next)
- {
+ for (edge = iarc->edges.first; edge; edge = edge->next) {
avg_angle += edge->angle;
nb_edges++;
}
@@ -1901,29 +1708,23 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
/* avg_length = iarc->length / nb_edges; */ /* UNUSED */
- if (nb_edges > 2)
- {
- for (edge = iarc->edges.first; edge; edge = edge->next)
- {
- if (fabs(edge->angle - avg_angle) > M_PI / 6)
- {
+ if (nb_edges > 2) {
+ for (edge = iarc->edges.first; edge; edge = edge->next) {
+ if (fabs(edge->angle - avg_angle) > M_PI / 6) {
large_angle = 1;
}
}
}
- else if (nb_edges == 2 && avg_angle > 0)
- {
+ else if (nb_edges == 2 && avg_angle > 0) {
large_angle = 1;
}
- if (large_angle == 0)
- {
+ if (large_angle == 0) {
mode = RETARGET_LENGTH;
}
- if (earc->bcount <= (iarc->count - 1))
- {
+ if (earc->bcount <= (iarc->count - 1)) {
mode = RETARGET_LENGTH;
}
@@ -1936,8 +1737,7 @@ static void printMovesNeeded(int *positions, int nb_positions)
int moves = 0;
int i;
- for (i = 0; i < nb_positions; i++)
- {
+ for (i = 0; i < nb_positions; i++) {
moves += positions[i] - (i + 1);
}
@@ -1948,8 +1748,7 @@ static void printPositions(int *positions, int nb_positions)
{
int i;
- for (i = 0; i < nb_positions; i++)
- {
+ for (i = 0; i < nb_positions; i++) {
printf("%i ", positions[i]);
}
printf("\n");
@@ -1965,17 +1764,14 @@ static float costDistance(BArcIterator *iter, float *vec0, float *vec1, int i0,
float v1[3], v2[3], c[3];
float v1_inpf;
- if (distance_weight > 0)
- {
+ if (distance_weight > 0) {
sub_v3_v3v3(v1, vec0, vec1);
v1_inpf = dot_v3v3(v1, v1);
- if (v1_inpf > 0)
- {
+ if (v1_inpf > 0) {
int j;
- for (j = i0 + 1; j < i1 - 1; j++)
- {
+ for (j = i0 + 1; j < i1 - 1; j++) {
float dist;
bucket = IT_peek(iter, j);
@@ -1991,48 +1787,40 @@ static float costDistance(BArcIterator *iter, float *vec0, float *vec1, int i0,
return distance_weight * max_dist;
}
- else
- {
+ else {
return MAX_COST;
}
}
- else
- {
+ else {
return 0;
}
}
static float costAngle(float original_angle, float vec_first[3], float vec_second[3], float angle_weight)
{
- if (angle_weight > 0)
- {
+ if (angle_weight > 0) {
float current_angle;
- if (!is_zero_v3(vec_first) && !is_zero_v3(vec_second))
- {
+ if (!is_zero_v3(vec_first) && !is_zero_v3(vec_second)) {
current_angle = saacos(dot_v3v3(vec_first, vec_second));
return angle_weight * fabsf(current_angle - original_angle);
}
- else
- {
+ else {
return angle_weight * (float)M_PI;
}
}
- else
- {
+ else {
return 0;
}
}
static float costLength(float original_length, float current_length, float length_weight)
{
- if (current_length == 0)
- {
+ if (current_length == 0) {
return MAX_COST;
}
- else
- {
+ else {
float length_ratio = fabs((current_length - original_length) / original_length);
return length_weight * length_ratio * length_ratio;
}
@@ -2062,8 +1850,7 @@ static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_
/* Angle cost */
- if (edge->prev)
- {
+ if (edge->prev) {
sub_v3_v3v3(vec_first, vec1, vec0);
normalize_v3(vec_first);
@@ -2089,8 +1876,7 @@ static void copyMemoPositions(int *positions, MemoNode *table, int nb_positions,
int previous = 0, current = 0;
int i = 0;
- for (i = 0; joints_left > 0; joints_left--, i++)
- {
+ for (i = 0; joints_left > 0; joints_left--, i++) {
MemoNode *node;
node = table + indexMemoNode(nb_positions, previous, current, joints_left);
@@ -2108,12 +1894,10 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
node = table + index;
- if (node->weight != 0)
- {
+ if (node->weight != 0) {
return node;
}
- else if (joints_left == 0)
- {
+ else if (joints_left == 0) {
float *vec0 = vec_cache[previous];
float *vec1 = vec_cache[current];
float *vec2 = vec_cache[nb_positions + 1];
@@ -2122,8 +1906,7 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
return node;
}
- else
- {
+ else {
MemoNode *min_node = NULL;
float *vec0 = vec_cache[previous];
float *vec1 = vec_cache[current];
@@ -2131,8 +1914,7 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
int min_next= 0;
int next;
- for (next = current + 1; next <= nb_positions - (joints_left - 1); next++)
- {
+ for (next = current + 1; next <= nb_positions - (joints_left - 1); next++) {
MemoNode *next_node;
float *vec2 = vec_cache[next];
float weight = 0.0f;
@@ -2140,8 +1922,7 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
/* ADD WEIGHT OF PREVIOUS - CURRENT - NEXT triple */
weight = calcCostAngleLengthDistance(iter, vec_cache, edge, vec0, vec1, vec2, current, next, angle_weight, length_weight, distance_weight);
- if (weight >= MAX_COST)
- {
+ if (weight >= MAX_COST) {
continue;
}
@@ -2149,22 +1930,19 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
next_node = solveJoints(table, iter, vec_cache, nb_joints, nb_positions, current, next, edge->next, joints_left - 1, angle_weight, length_weight, distance_weight);
weight += next_node->weight;
- if (min_node == NULL || weight < min_weight)
- {
+ if (min_node == NULL || weight < min_weight) {
min_weight = weight;
min_node = next_node;
min_next = next;
}
}
- if (min_node)
- {
+ if (min_node) {
node->weight = min_weight;
node->next = min_next;
return node;
}
- else
- {
+ else {
node->weight = MAX_COST;
return node;
}
@@ -2178,12 +1956,12 @@ static int testFlipArc(RigArc *iarc, RigNode *inode_start)
ReebNode *enode_start = BIF_NodeFromIndex(earc, inode_start->link_mesh);
/* no flip needed if both nodes are the same */
- if ((enode_start == earc->head && inode_start == iarc->head) || (enode_start == earc->tail && inode_start == iarc->tail))
+ if ((enode_start == earc->head && inode_start == iarc->head) ||
+ (enode_start == earc->tail && inode_start == iarc->tail))
{
return 0;
}
- else
- {
+ else {
return 1;
}
}
@@ -2209,38 +1987,32 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
RetargetMethod method = METHOD_MEMOIZE;
int i;
- if (nb_joints > earc->bcount)
- {
+ if (nb_joints > earc->bcount) {
printf("NOT ENOUGH BUCKETS!\n");
return;
}
best_positions = MEM_callocN(sizeof(int) * nb_joints, "Best positions");
- if (testFlipArc(iarc, inode_start))
- {
+ if (testFlipArc(iarc, inode_start)) {
node_start = earc->tail;
node_end = earc->head;
}
- else
- {
+ else {
node_start = earc->head;
node_end = earc->tail;
}
/* equal number of joints and potential position, just fill them in */
- if (nb_joints == earc->bcount)
- {
+ if (nb_joints == earc->bcount) {
int i;
/* init with first values */
- for (i = 0; i < nb_joints; i++)
- {
+ for (i = 0; i < nb_joints; i++) {
best_positions[i] = i + 1;
}
}
- if (method == METHOD_MEMOIZE)
- {
+ if (method == METHOD_MEMOIZE) {
int nb_positions = earc->bcount;
int nb_memo_nodes = nb_positions * nb_positions * (nb_joints + 1);
MemoNode *table = MEM_callocN(nb_memo_nodes * sizeof(MemoNode), "memoization table");
@@ -2255,8 +2027,7 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
initArcIterator(iter, earc, node_start);
- for (i = 1; i <= nb_positions; i++)
- {
+ for (i = 1; i <= nb_positions; i++) {
EmbedBucket *bucket = IT_peek(iter, i);
positions_cache[i] = bucket->p;
}
@@ -2290,20 +2061,17 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
edge = edge->next, i++)
{
float *no = NULL;
- if (i < nb_joints)
- {
+ if (i < nb_joints) {
bucket = IT_peek(iter, best_positions[i]);
vec1 = bucket->p;
no = bucket->no;
}
- else
- {
+ else {
vec1 = node_end->p;
no = node_end->no;
}
- if (edge->bone)
- {
+ if (edge->bone) {
repositionBone(C, rigg, edge, vec0, vec1, no);
}
@@ -2327,13 +2095,11 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
float *previous_vec = NULL;
- if (testFlipArc(iarc, inode_start))
- {
+ if (testFlipArc(iarc, inode_start)) {
node_start = (ReebNode*)earc->tail;
node_end = (ReebNode*)earc->head;
}
- else
- {
+ else {
node_start = (ReebNode*)earc->head;
node_end = (ReebNode*)earc->tail;
}
@@ -2344,8 +2110,7 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
vec0 = node_start->p;
- while (bucket != NULL)
- {
+ while (bucket != NULL) {
vec1 = bucket->p;
embedding_length += len_v3v3(vec0, vec1);
@@ -2365,14 +2130,12 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
previous_vec = vec0;
vec1 = bucket->p;
- for (edge = iarc->edges.first; edge; edge = edge->next)
- {
+ for (edge = iarc->edges.first; edge; edge = edge->next) {
float new_bone_length = edge->length / iarc->length * embedding_length;
float *no = NULL;
float length = 0;
- while (bucket && new_bone_length > length)
- {
+ while (bucket && new_bone_length > length) {
length += len_v3v3(previous_vec, vec1);
bucket = IT_next(iter);
previous_vec = vec1;
@@ -2380,15 +2143,13 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
no = bucket->no;
}
- if (bucket == NULL)
- {
+ if (bucket == NULL) {
vec1 = node_end->p;
no = node_end->no;
}
/* no need to move virtual edges (space between unconnected bones) */
- if (edge->bone)
- {
+ if (edge->bone) {
repositionBone(C, rigg, edge, vec0, vec1, no);
}
@@ -2429,29 +2190,23 @@ void *exec_retargetArctoArc(void *param)
RigNode *inode_start = p->inode_start;
ReebArc *earc = iarc->link_mesh;
- if (BLI_countlist(&iarc->edges) == 1)
- {
+ if (BLI_countlist(&iarc->edges) == 1) {
RigEdge *edge = iarc->edges.first;
- if (testFlipArc(iarc, inode_start))
- {
+ if (testFlipArc(iarc, inode_start)) {
repositionBone(C, rigg, edge, earc->tail->p, earc->head->p, earc->head->no);
}
- else
- {
+ else {
repositionBone(C, rigg, edge, earc->head->p, earc->tail->p, earc->tail->no);
}
}
- else
- {
+ else {
RetargetMode mode = detectArcRetargetMode(iarc);
- if (mode == RETARGET_AGGRESSIVE)
- {
+ if (mode == RETARGET_AGGRESSIVE) {
retargetArctoArcAggresive(C, rigg, iarc, inode_start);
}
- else
- {
+ else {
retargetArctoArcLength(C, rigg, iarc, inode_start);
}
}
@@ -2474,8 +2229,7 @@ static void matchMultiResolutionNode(RigGraph *rigg, RigNode *inode, ReebNode *t
inode->link_mesh = enode;
- while (ishape == eshape && enode->link_down)
- {
+ while (ishape == eshape && enode->link_down) {
inode->link_mesh = enode;
enode = enode->link_down;
@@ -2488,16 +2242,13 @@ static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
{
int i;
- for (i = 0; i < enode->degree; i++)
- {
+ for (i = 0; i < enode->degree; i++) {
ReebArc *earc = (ReebArc*)enode->arcs[i];
- if (earc->flag == ARC_FREE)
- {
+ if (earc->flag == ARC_FREE) {
earc->flag = ARC_TAKEN;
- if (earc->tail->degree > 1 && earc->tail != end_enode)
- {
+ if (earc->tail->degree > 1 && earc->tail != end_enode) {
markMultiResolutionChildArc(end_enode, earc->tail);
}
break;
@@ -2507,15 +2258,12 @@ static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
static void markMultiResolutionArc(ReebArc *start_earc)
{
- if (start_earc->link_up)
- {
+ if (start_earc->link_up) {
ReebArc *earc;
- for (earc = start_earc->link_up ; earc; earc = earc->link_up)
- {
+ for (earc = start_earc->link_up ; earc; earc = earc->link_up) {
earc->flag = ARC_TAKEN;
- if (earc->tail->index != start_earc->tail->index)
- {
+ if (earc->tail->index != start_earc->tail->index) {
markMultiResolutionChildArc(earc->tail, earc->tail);
}
}
@@ -2531,8 +2279,7 @@ static void matchMultiResolutionArc(RigGraph *rigg, RigNode *start_node, RigArc
ishape = BLI_subtreeShape((BGraph*)rigg, (BNode*)start_node, (BArc*)next_iarc, 1) % SHAPE_LEVELS;
eshape = BLI_subtreeShape((BGraph*)reebg, (BNode*)enode, (BArc*)next_earc, 1) % SHAPE_LEVELS;
- while (ishape != eshape && next_earc->link_up)
- {
+ while (ishape != eshape && next_earc->link_up) {
next_earc->flag = ARC_TAKEN; // mark previous as taken, to prevent backtrack on lower levels
next_earc = next_earc->link_up;
@@ -2563,8 +2310,7 @@ static void matchMultiResolutionStartingNode(RigGraph *rigg, ReebGraph *reebg, R
ishape = BLI_subtreeShape((BGraph*)rigg, (BNode*)inode, NULL, 0) % SHAPE_LEVELS;
eshape = BLI_subtreeShape((BGraph*)rigg->link_mesh, (BNode*)enode, NULL, 0) % SHAPE_LEVELS;
- while (ishape != eshape && reebg->link_up)
- {
+ while (ishape != eshape && reebg->link_up) {
reebg = reebg->link_up;
enode = reebg->nodes.first;
@@ -2593,8 +2339,7 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// RIG_printArcBones(next_iarc);
// }
- for (i = 0; i < enode->degree; i++)
- {
+ for (i = 0; i < enode->degree; i++) {
next_earc = (ReebArc*)enode->arcs[i];
// if (next_earc->flag == ARC_FREE)
@@ -2619,20 +2364,17 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
}
/* not found, try at higher nodes (lower node might have filtered internal arcs, messing shape of tree */
- if (next_iarc->link_mesh == NULL)
- {
+ if (next_iarc->link_mesh == NULL) {
// printf("NO CORRESPONDING ARC FOUND - GOING TO HIGHER LEVELS\n");
- if (enode->link_up)
- {
+ if (enode->link_up) {
start_node->link_mesh = enode->link_up;
findCorrespondingArc(rigg, start_arc, start_node, next_iarc, 0);
}
}
/* still not found, print debug info */
- if (root && next_iarc->link_mesh == NULL)
- {
+ if (root && next_iarc->link_mesh == NULL) {
start_node->link_mesh = enode; /* linking back with root node */
// printf("NO CORRESPONDING ARC FOUND\n");
@@ -2651,12 +2393,10 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// }
/* Emergency matching */
- for (i = 0; i < enode->degree; i++)
- {
+ for (i = 0; i < enode->degree; i++) {
next_earc = (ReebArc*)enode->arcs[i];
- if (next_earc->flag == ARC_FREE && next_earc->symmetry_level == symmetry_level)
- {
+ if (next_earc->flag == ARC_FREE && next_earc->symmetry_level == symmetry_level) {
// printf("USING:\n");
// printf("flag %i -- level %i -- flag %i -- group %i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag, next_earc->symmetry_group);
matchMultiResolutionArc(rigg, start_node, next_iarc, next_earc);
@@ -2673,8 +2413,7 @@ static void retargetSubgraph(bContext *C, RigGraph *rigg, RigArc *start_arc, Rig
int i;
/* no start arc on first node */
- if (start_arc)
- {
+ if (start_arc) {
ReebNode *enode = start_node->link_mesh;
ReebArc *earc = start_arc->link_mesh;
@@ -2687,16 +2426,13 @@ static void retargetSubgraph(bContext *C, RigGraph *rigg, RigArc *start_arc, Rig
matchMultiResolutionNode(rigg, inode, enode);
}
- for (i = 0; i < inode->degree; i++)
- {
+ for (i = 0; i < inode->degree; i++) {
RigArc *next_iarc = (RigArc*)inode->arcs[i];
/* no back tracking */
- if (next_iarc != start_arc)
- {
+ if (next_iarc != start_arc) {
findCorrespondingArc(rigg, start_arc, inode, next_iarc, 1);
- if (next_iarc->link_mesh)
- {
+ if (next_iarc->link_mesh) {
retargetSubgraph(C, rigg, next_iarc, inode);
}
}
@@ -2715,10 +2451,8 @@ static void adjustGraphs(bContext *C, RigGraph *rigg)
bArmature *arm= rigg->ob->data;
RigArc *arc;
- for (arc = rigg->arcs.first; arc; arc = arc->next)
- {
- if (arc->link_mesh)
- {
+ for (arc = rigg->arcs.first; arc; arc = arc->next) {
+ if (arc->link_mesh) {
retargetArctoArc(C, rigg, arc, arc->head);
}
}
@@ -2762,25 +2496,21 @@ const char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index)
RigArc *arc = BLI_findlink(&rg->arcs, arc_index);
RigEdge *iedge;
- if (arc == NULL)
- {
+ if (arc == NULL) {
return "None";
}
- if (bone_index == BLI_countlist(&arc->edges))
- {
+ if (bone_index == BLI_countlist(&arc->edges)) {
return "Last joint";
}
iedge = BLI_findlink(&arc->edges, bone_index);
- if (iedge == NULL)
- {
+ if (iedge == NULL) {
return "Done";
}
- if (iedge->bone == NULL)
- {
+ if (iedge->bone == NULL) {
return "Bone offset";
}
@@ -2794,8 +2524,7 @@ int RIG_nbJoints(RigGraph *rg)
total += BLI_countlist(&rg->nodes);
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
total += BLI_countlist(&arc->edges) - 1; /* -1 because end nodes are already counted */
}
@@ -2804,8 +2533,7 @@ int RIG_nbJoints(RigGraph *rg)
static void BIF_freeRetarget(void)
{
- if (GLOBAL_RIGG)
- {
+ if (GLOBAL_RIGG) {
RIG_freeRigGraph((BGraph*)GLOBAL_RIGG);
GLOBAL_RIGG = NULL;
}
@@ -2827,11 +2555,10 @@ void BIF_retargetArmature(bContext *C)
printf("Reeb Graph created\n");
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
Object *ob = base->object;
- if (ob->type==OB_ARMATURE)
- {
+ if (ob->type==OB_ARMATURE) {
RigGraph *rigg;
bArmature *arm;
@@ -2910,8 +2637,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
template_rigg = armatureSelectedToGraph(C, ob, ob->data);
}
- if (template_rigg->arcs.first == NULL)
- {
+ if (template_rigg->arcs.first == NULL) {
// XXX
// error("No Template and no deforming bones selected");
return;
@@ -2930,8 +2656,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
finishRetarget(rigg);
/* free template if it comes from the edit armature */
- if (free_template)
- {
+ if (free_template) {
RIG_freeRigGraph((BGraph*)template_rigg);
}
RIG_freeRigGraph((BGraph*)rigg);
@@ -2944,8 +2669,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
void BIF_adjustRetarget(bContext *C)
{
- if (GLOBAL_RIGG)
- {
+ if (GLOBAL_RIGG) {
adjustGraphs(C, GLOBAL_RIGG);
}
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 81b020a4cf9..09b0226c58c 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -162,25 +162,21 @@ void BIF_makeListTemplates(const bContext *C)
Base *base;
int index = 0;
- if (TEMPLATES_HASH != NULL)
- {
+ if (TEMPLATES_HASH != NULL) {
BLI_ghash_free(TEMPLATES_HASH, NULL, NULL);
}
TEMPLATES_HASH = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "makeListTemplates gh");
TEMPLATES_CURRENT = 0;
- for ( base = FIRSTBASE; base; base = base->next )
- {
+ for ( base = FIRSTBASE; base; base = base->next ) {
Object *ob = base->object;
- if (ob != obedit && ob->type == OB_ARMATURE)
- {
+ if (ob != obedit && ob->type == OB_ARMATURE) {
index++;
BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob);
- if (ob == ts->skgen_template)
- {
+ if (ob == ts->skgen_template) {
TEMPLATES_CURRENT = index;
}
}
@@ -193,8 +189,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C))
char menu_header[] = "Template%t|None%x0|";
char *p;
- if (TEMPLATES_MENU != NULL)
- {
+ if (TEMPLATES_MENU != NULL) {
MEM_freeN(TEMPLATES_MENU);
}
@@ -206,8 +201,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C))
BLI_ghashIterator_init(&ghi, TEMPLATES_HASH);
- while (!BLI_ghashIterator_isDone(&ghi))
- {
+ while (!BLI_ghashIterator_isDone(&ghi)) {
Object *ob = BLI_ghashIterator_getValue(&ghi);
int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
@@ -223,18 +217,15 @@ int BIF_currentTemplate(const bContext *C)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL)
- {
+ if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL) {
GHashIterator ghi;
BLI_ghashIterator_init(&ghi, TEMPLATES_HASH);
- while (!BLI_ghashIterator_isDone(&ghi))
- {
+ while (!BLI_ghashIterator_isDone(&ghi)) {
Object *ob = BLI_ghashIterator_getValue(&ghi);
int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
- if (ob == ts->skgen_template)
- {
+ if (ob == ts->skgen_template) {
TEMPLATES_CURRENT = key;
break;
}
@@ -249,21 +240,17 @@ int BIF_currentTemplate(const bContext *C)
static RigGraph* sk_makeTemplateGraph(const bContext *C, Object *ob)
{
Object *obedit = CTX_data_edit_object(C);
- if (ob == obedit)
- {
+ if (ob == obedit) {
return NULL;
}
- if (ob != NULL)
- {
- if (TEMPLATE_RIGG && TEMPLATE_RIGG->ob != ob)
- {
+ if (ob != NULL) {
+ if (TEMPLATE_RIGG && TEMPLATE_RIGG->ob != ob) {
RIG_freeRigGraph((BGraph*)TEMPLATE_RIGG);
TEMPLATE_RIGG = NULL;
}
- if (TEMPLATE_RIGG == NULL)
- {
+ if (TEMPLATE_RIGG == NULL) {
bArmature *arm;
arm = ob->data;
@@ -280,12 +267,10 @@ int BIF_nbJointsTemplate(const bContext *C)
ToolSettings *ts = CTX_data_tool_settings(C);
RigGraph *rg = sk_makeTemplateGraph(C, ts->skgen_template);
- if (rg)
- {
+ if (rg) {
return RIG_nbJoints(rg);
}
- else
- {
+ else {
return -1;
}
}
@@ -297,15 +282,13 @@ const char * BIF_nameBoneTemplate(const bContext *C)
RigGraph *rg;
int index = 0;
- if (stk && stk->active_stroke != NULL)
- {
+ if (stk && stk->active_stroke != NULL) {
index = stk->active_stroke->nb_points;
}
rg = sk_makeTemplateGraph(C, ts->skgen_template);
- if (rg == NULL)
- {
+ if (rg == NULL) {
return "";
}
@@ -314,20 +297,17 @@ const char * BIF_nameBoneTemplate(const bContext *C)
void BIF_freeTemplates(bContext *UNUSED(C))
{
- if (TEMPLATES_MENU != NULL)
- {
+ if (TEMPLATES_MENU != NULL) {
MEM_freeN(TEMPLATES_MENU);
TEMPLATES_MENU = NULL;
}
- if (TEMPLATES_HASH != NULL)
- {
+ if (TEMPLATES_HASH != NULL) {
BLI_ghash_free(TEMPLATES_HASH, NULL, NULL);
TEMPLATES_HASH = NULL;
}
- if (TEMPLATE_RIGG != NULL)
- {
+ if (TEMPLATE_RIGG != NULL) {
RIG_freeRigGraph((BGraph*)TEMPLATE_RIGG);
TEMPLATE_RIGG = NULL;
}
@@ -336,16 +316,13 @@ void BIF_freeTemplates(bContext *UNUSED(C))
void BIF_setTemplate(bContext *C, int index)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (index > 0)
- {
+ if (index > 0) {
ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index));
}
- else
- {
+ else {
ts->skgen_template = NULL;
- if (TEMPLATE_RIGG != NULL)
- {
+ if (TEMPLATE_RIGG != NULL) {
RIG_freeRigGraph((BGraph*)TEMPLATE_RIGG);
}
TEMPLATE_RIGG = NULL;
@@ -357,44 +334,35 @@ void BIF_setTemplate(bContext *C, int index)
static void sk_autoname(bContext *C, ReebArc *arc)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME)
- {
- if (arc == NULL)
- {
+ if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME) {
+ if (arc == NULL) {
char *num = ts->skgen_num_string;
int i = atoi(num);
i++;
BLI_snprintf(num, 8, "%i", i);
}
- else
- {
+ else {
char *side = ts->skgen_side_string;
int valid = 0;
int caps = 0;
- if (side[0] == '\0')
- {
+ if (side[0] == '\0') {
valid = 1;
}
- else if (strcmp(side, "R")==0 || strcmp(side, "L")==0)
- {
+ else if (strcmp(side, "R")==0 || strcmp(side, "L")==0) {
valid = 1;
caps = 1;
}
- else if (strcmp(side, "r")==0 || strcmp(side, "l")==0)
- {
+ else if (strcmp(side, "r")==0 || strcmp(side, "l")==0) {
valid = 1;
caps = 0;
}
- if (valid)
- {
- if (arc->head->p[0] < 0)
- {
+ if (valid) {
+ if (arc->head->p[0] < 0) {
BLI_snprintf(side, 8, caps?"R":"r");
}
- else
- {
+ else {
BLI_snprintf(side, 8, caps?"L":"l");
}
}
@@ -428,8 +396,7 @@ static ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3])
arc->bcount = stk->nb_points - 2; /* first and last are nodes, don't count */
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "Buckets");
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
copy_v3_v3(arc->buckets[i].p, stk->points[i + 1].p);
mul_m4_v3(imat, arc->buckets[i].p);
@@ -473,8 +440,7 @@ static void sk_retargetStroke(bContext *C, SK_Stroke *stk)
static void sk_cancelStroke(SK_Sketch *sketch)
{
- if (sketch->active_stroke != NULL)
- {
+ if (sketch->active_stroke != NULL) {
sk_resetOverdraw(sketch);
sk_removeStroke(sketch, sketch->active_stroke);
}
@@ -501,8 +467,7 @@ static void sk_drawEdge(GLUquadric *quad, SK_Point *pt0, SK_Point *pt1, float si
length = normalize_v3(vec1);
cross_v3_v3v3(axis, vec2, vec1);
- if (is_zero_v3(axis))
- {
+ if (is_zero_v3(axis)) {
axis[1] = 1;
}
@@ -522,8 +487,7 @@ static void sk_drawNormal(GLUquadric *quad, SK_Point *pt, float size, float heig
cross_v3_v3v3(axis, vec2, pt->no);
- if (is_zero_v3(axis))
- {
+ if (is_zero_v3(axis)) {
axis[1] = 1;
}
@@ -544,18 +508,15 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
GLUquadric *quad = gluNewQuadric();
gluQuadricNormals(quad, GLU_SMOOTH);
- if (id != -1)
- {
+ if (id != -1) {
glLoadName(id);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
glPushMatrix();
sk_drawPoint(quad, stk->points + i, 0.1);
- if (i > 0)
- {
+ if (i > 0) {
sk_drawEdge(quad, stk->points + i - 1, stk->points + i, 0.1);
}
@@ -563,44 +524,37 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
}
}
- else
- {
+ else {
float d_rgb[3] = {1, 1, 1};
copy_v3_v3(rgb, color);
sub_v3_v3(d_rgb, rgb);
mul_v3_fl(d_rgb, 1.0f / (float)stk->nb_points);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
SK_Point *pt = stk->points + i;
glPushMatrix();
- if (pt->type == PT_EXACT)
- {
+ if (pt->type == PT_EXACT) {
glColor3f(0, 0, 0);
sk_drawPoint(quad, pt, 0.15);
sk_drawNormal(quad, pt, 0.05, 0.9);
}
- if (i >= start && i <= end)
- {
+ if (i >= start && i <= end) {
glColor3f(0.3, 0.3, 0.3);
}
- else
- {
+ else {
glColor3fv(rgb);
}
- if (pt->type != PT_EXACT)
- {
+ if (pt->type != PT_EXACT) {
sk_drawPoint(quad, pt, 0.1);
}
- if (i > 0)
- {
+ if (i > 0) {
sk_drawEdge(quad, pt - 1, pt, 0.1);
}
@@ -627,8 +581,7 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite
copy_v3_v3(head, iter->p);
index = next_subdividion(toolsettings, iter, bone_start, end, head, tail);
- while (index != -1)
- {
+ while (index != -1) {
SK_Point *pt = stk->points + index;
glPushMatrix();
@@ -654,41 +607,32 @@ static void sk_drawStrokeSubdivision(ToolSettings *toolsettings, SK_Stroke *stk)
int head_index = -1;
int i;
- if (toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET)
- {
+ if (toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET) {
return;
}
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
SK_Point *pt = stk->points + i;
- if (pt->type == PT_EXACT || i == stk->nb_points - 1) /* stop on exact or on last point */
- {
- if (head_index == -1)
- {
+ if (pt->type == PT_EXACT || i == stk->nb_points - 1) /* stop on exact or on last point */ {
+ if (head_index == -1) {
head_index = i;
}
- else
- {
- if (i - head_index > 1)
- {
+ else {
+ if (i - head_index > 1) {
SK_StrokeIterator sk_iter;
BArcIterator *iter = (BArcIterator*)&sk_iter;
initStrokeIterator(iter, stk, head_index, i);
- if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
- {
+ if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE) {
drawSubdividedStrokeBy(toolsettings, iter, nextAdaptativeSubdivision);
}
- else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
- {
+ else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH) {
drawSubdividedStrokeBy(toolsettings, iter, nextLengthSubdivision);
}
- else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
- {
+ else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED) {
drawSubdividedStrokeBy(toolsettings, iter, nextFixedSubdivision);
}
@@ -706,10 +650,8 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], in
SK_Point *pt = NULL;
int i;
- for (i = 0; i < stk->nb_points; i++)
- {
- if (all_pts || stk->points[i].type == PT_EXACT)
- {
+ for (i = 0; i < stk->nb_points; i++) {
+ if (all_pts || stk->points[i].type == PT_EXACT) {
short pval[2];
int pdist;
@@ -717,13 +659,11 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], in
pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
- if (pdist < *dist)
- {
+ if (pdist < *dist) {
*dist = pdist;
pt = stk->points + i;
- if (index != NULL)
- {
+ if (index != NULL) {
*index = i;
}
}
@@ -801,75 +741,60 @@ int sk_hasOverdraw(SK_Sketch *sketch, SK_Stroke *stk)
static void sk_updateOverdraw(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd)
{
- if (sketch->over.target == NULL)
- {
+ if (sketch->over.target == NULL) {
SK_Stroke *target;
int closest_index = -1;
int dist = SNAP_MIN_DISTANCE * 2;
- for (target = sketch->strokes.first; target; target = target->next)
- {
- if (target != stk)
- {
+ for (target = sketch->strokes.first; target; target = target->next) {
+ if (target != stk) {
int index;
SK_Point *spt = sk_snapPointStroke(C, target, dd->mval, &dist, &index, 1);
- if (spt != NULL)
- {
+ if (spt != NULL) {
sketch->over.target = target;
closest_index = index;
}
}
}
- if (sketch->over.target != NULL)
- {
- if (closest_index > -1)
- {
- if (sk_lastStrokePoint(stk)->type == PT_EXACT)
- {
+ if (sketch->over.target != NULL) {
+ if (closest_index > -1) {
+ if (sk_lastStrokePoint(stk)->type == PT_EXACT) {
sketch->over.count = SK_OVERDRAW_LIMIT;
}
- else
- {
+ else {
sketch->over.count++;
}
}
- if (stk->nb_points == 1)
- {
+ if (stk->nb_points == 1) {
sketch->over.start = closest_index;
}
- else
- {
+ else {
sketch->over.end = closest_index;
}
}
}
- else if (sketch->over.target != NULL)
- {
+ else if (sketch->over.target != NULL) {
SK_Point *closest_pt = NULL;
int dist = SNAP_MIN_DISTANCE * 2;
int index;
closest_pt = sk_snapPointStroke(C, sketch->over.target, dd->mval, &dist, &index, 1);
- if (closest_pt != NULL)
- {
- if (sk_lastStrokePoint(stk)->type == PT_EXACT)
- {
+ if (closest_pt != NULL) {
+ if (sk_lastStrokePoint(stk)->type == PT_EXACT) {
sketch->over.count = SK_OVERDRAW_LIMIT;
}
- else
- {
+ else {
sketch->over.count++;
}
sketch->over.end = index;
}
- else
- {
+ else {
sketch->over.end = -1;
}
}
@@ -883,18 +808,15 @@ static int sk_adjustIndexes(SK_Sketch *sketch, int *start, int *end)
*start = sketch->over.start;
*end = sketch->over.end;
- if (*start == -1)
- {
+ if (*start == -1) {
*start = 0;
}
- if (*end == -1)
- {
+ if (*end == -1) {
*end = sketch->over.target->nb_points - 1;
}
- if (*end < *start)
- {
+ if (*end < *start) {
int tmp = *start;
*start = *end;
*end = tmp;
@@ -908,18 +830,15 @@ static void sk_endOverdraw(SK_Sketch *sketch)
{
SK_Stroke *stk = sketch->active_stroke;
- if (sk_hasOverdraw(sketch, NULL))
- {
+ if (sk_hasOverdraw(sketch, NULL)) {
int start;
int end;
- if (sk_adjustIndexes(sketch, &start, &end))
- {
+ if (sk_adjustIndexes(sketch, &start, &end)) {
sk_reverseStroke(stk);
}
- if (stk->nb_points > 1)
- {
+ if (stk->nb_points > 1) {
stk->points->type = sketch->over.target->points[start].type;
sk_lastStrokePoint(stk)->type = sketch->over.target->points[end].type;
}
@@ -948,8 +867,7 @@ static void sk_endStroke(bContext *C, SK_Sketch *sketch)
ToolSettings *ts = CTX_data_tool_settings(C);
sk_shrinkStrokeBuffer(sketch->active_stroke);
- if (ts->bone_sketching & BONE_SKETCHING_ADJUST)
- {
+ if (ts->bone_sketching & BONE_SKETCHING_ADJUST) {
sk_endOverdraw(sketch);
}
@@ -977,8 +895,7 @@ static float sk_distanceDepth(bContext *C, float p1[3], float p2[3])
distance = len_v3(vec);
- if (dot_v3v3(rv3d->viewinv[2], vec) > 0)
- {
+ if (dot_v3v3(rv3d->viewinv[2], vec) > 0) {
distance *= -1;
}
@@ -996,8 +913,7 @@ static void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end,
progress = len_v3v3(stk->points[start].p, stk->points[start - 1].p);
- for (i = start; i <= end; i++)
- {
+ for (i = start; i <= end; i++) {
float ray_start[3], ray_normal[3];
float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p);
float pval[2];
@@ -1022,8 +938,7 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr
float dvec[3];
float mval_f[2];
- if (last != NULL)
- {
+ if (last != NULL) {
copy_v3_v3(fp, last->p);
}
@@ -1065,8 +980,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
ToolSettings *ts = CTX_data_tool_settings(C);
int point_added = 0;
- if (ts->snap_mode == SCE_SNAP_MODE_VOLUME)
- {
+ if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
DepthPeel *p1, *p2;
float *last_p = NULL;
float dist = FLT_MAX;
@@ -1081,20 +995,16 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
mvalf[1]= dd->mval[1];
peelObjectsContext(C, &sketch->depth_peels, mvalf, SNAP_ALL);
- if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS)
- {
+ if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS) {
last_p = stk->points[stk->nb_points - 1].p;
}
- else if (LAST_SNAP_POINT_VALID)
- {
+ else if (LAST_SNAP_POINT_VALID) {
last_p = LAST_SNAP_POINT;
}
- for (p1 = sketch->depth_peels.first; p1; p1 = p1->next)
- {
- if (p1->flag == 0)
- {
+ for (p1 = sketch->depth_peels.first; p1; p1 = p1->next) {
+ if (p1->flag == 0) {
float vec[3];
float new_dist;
float new_size = 0;
@@ -1103,42 +1013,34 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
p1->flag = 1;
/* if peeling objects, take the first and last from each object */
- if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT)
- {
+ if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT) {
DepthPeel *peel;
- for (peel = p1->next; peel; peel = peel->next)
- {
- if (peel->ob == p1->ob)
- {
+ for (peel = p1->next; peel; peel = peel->next) {
+ if (peel->ob == p1->ob) {
peel->flag = 1;
p2 = peel;
}
}
}
/* otherwise, pair first with second and so on */
- else
- {
- for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next)
- {
+ else {
+ for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) {
/* nothing to do here */
}
}
- if (p2)
- {
+ if (p2) {
p2->flag = 1;
add_v3_v3v3(vec, p1->p, p2->p);
mul_v3_fl(vec, 0.5f);
new_size = len_v3v3(p1->p, p2->p);
}
- else
- {
+ else {
copy_v3_v3(vec, p1->p);
}
- if (last_p == NULL)
- {
+ if (last_p == NULL) {
copy_v3_v3(p, vec);
size = new_size;
dist = 0;
@@ -1147,8 +1049,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
new_dist = len_v3v3(last_p, vec);
- if (new_dist < dist)
- {
+ if (new_dist < dist) {
copy_v3_v3(p, vec);
dist = new_dist;
size = new_size;
@@ -1156,8 +1057,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
}
}
- if (dist != FLT_MAX)
- {
+ if (dist != FLT_MAX) {
pt->type = dd->type;
pt->mode = PT_SNAP;
pt->size = size / 2;
@@ -1168,8 +1068,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
//BLI_freelistN(&depth_peels);
}
- else
- {
+ else {
SK_Stroke *snap_stk;
float vec[3];
float no[3];
@@ -1179,20 +1078,16 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
/* snap to strokes */
// if (ts->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */
- for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next)
- {
+ for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next) {
SK_Point *spt = NULL;
- if (snap_stk == stk)
- {
+ if (snap_stk == stk) {
spt = sk_snapPointStroke(C, snap_stk, dd->mval, &dist, NULL, 0);
}
- else
- {
+ else {
spt = sk_snapPointStroke(C, snap_stk, dd->mval, &dist, NULL, 1);
}
- if (spt != NULL)
- {
+ if (spt != NULL) {
copy_v3_v3(pt->p, spt->p);
point_added = 1;
}
@@ -1203,8 +1098,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
/* try to snap to closer object */
found = snapObjectsContext(C, mval, &dist, vec, no, SNAP_NOT_SELECTED);
- if (found == 1)
- {
+ if (found == 1) {
pt->type = dd->type;
pt->mode = PT_SNAP;
copy_v3_v3(pt->p, vec);
@@ -1227,8 +1121,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk,
point_added = sk_getStrokeSnapPoint(C, &pt, sketch, stk, dd);
- if (point_added)
- {
+ if (point_added) {
float final_p[3];
float length, distance;
int total;
@@ -1242,18 +1135,15 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk,
/* update all previous point to give smooth Z progresion */
total = 0;
length = 0;
- for (i = stk->nb_points - 2; i > 0; i--)
- {
+ for (i = stk->nb_points - 2; i > 0; i--) {
length += len_v3v3(stk->points[i].p, stk->points[i + 1].p);
total++;
- if (stk->points[i].mode == PT_SNAP || stk->points[i].type == PT_EXACT)
- {
+ if (stk->points[i].mode == PT_SNAP || stk->points[i].type == PT_EXACT) {
break;
}
}
- if (total > 1)
- {
+ if (total > 1) {
distance = sk_distanceDepth(C, final_p, stk->points[i].p);
sk_interpolateDepth(C, stk, i + 1, stk->nb_points - 2, length, distance);
@@ -1272,18 +1162,15 @@ static void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK
ToolSettings *ts = CTX_data_tool_settings(C);
int point_added = 0;
- if (snap)
- {
+ if (snap) {
point_added = sk_addStrokeSnapPoint(C, sketch, stk, dd);
}
- if (point_added == 0)
- {
+ if (point_added == 0) {
point_added = sk_addStrokeDrawPoint(C, sketch, stk, dd);
}
- if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST)
- {
+ if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST) {
sk_updateOverdraw(C, sketch, stk, dd);
}
}
@@ -1292,19 +1179,16 @@ static void sk_getStrokePoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_S
{
int point_added = 0;
- if (snap)
- {
+ if (snap) {
point_added = sk_getStrokeSnapPoint(C, pt, sketch, stk, dd);
LAST_SNAP_POINT_VALID = 1;
copy_v3_v3(LAST_SNAP_POINT, pt->p);
}
- else
- {
+ else {
LAST_SNAP_POINT_VALID = 0;
}
- if (point_added == 0)
- {
+ if (point_added == 0) {
point_added = sk_getStrokeDrawPoint(C, pt, sketch, stk, dd);
}
}
@@ -1334,15 +1218,13 @@ static SK_Point* setIteratorValues(SK_StrokeIterator *iter, int index)
{
SK_Point *pt = NULL;
- if (index >= 0 && index < iter->length)
- {
+ if (index >= 0 && index < iter->length) {
pt = &(iter->stroke->points[iter->start + (iter->stride * index)]);
iter->p = pt->p;
iter->no = pt->no;
iter->size = pt->size;
}
- else
- {
+ else {
iter->p = NULL;
iter->no = NULL;
iter->size = 0;
@@ -1358,14 +1240,12 @@ void initStrokeIterator(BArcIterator *arg, SK_Stroke *stk, int start, int end)
initIteratorFct(iter);
iter->stroke = stk;
- if (start < end)
- {
+ if (start < end) {
iter->start = start + 1;
iter->end = end - 1;
iter->stride = 1;
}
- else
- {
+ else {
iter->start = start - 1;
iter->end = end + 1;
iter->stride = -1;
@@ -1409,8 +1289,7 @@ static void* nextPoint(void *arg)
SK_Point *result = NULL;
iter->index++;
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = setIteratorValues(iter, iter->index);
}
@@ -1425,8 +1304,7 @@ static void* nextNPoint(void *arg, int n)
iter->index += n;
/* check if passed end */
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = setIteratorValues(iter, iter->index);
}
@@ -1440,8 +1318,7 @@ static void* peekPoint(void *arg, int n)
int index = iter->index + n;
/* check if passed end */
- if (index < iter->length)
- {
+ if (index < iter->length) {
result = setIteratorValues(iter, index);
}
@@ -1453,8 +1330,7 @@ static void* previousPoint(void *arg)
SK_StrokeIterator *iter = (SK_StrokeIterator*)arg;
SK_Point *result = NULL;
- if (iter->index > 0)
- {
+ if (iter->index > 0) {
iter->index--;
result = setIteratorValues(iter, iter->index);
}
@@ -1466,12 +1342,10 @@ static int iteratorStopped(void *arg)
{
SK_StrokeIterator *iter = (SK_StrokeIterator*)arg;
- if (iter->index >= iter->length)
- {
+ if (iter->index >= iter->length) {
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -1495,45 +1369,36 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk)
copy_m3_m4(tmat, obedit->obmat);
transpose_m3(tmat);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
SK_Point *pt = stk->points + i;
- if (pt->type == PT_EXACT)
- {
- if (head == NULL)
- {
+ if (pt->type == PT_EXACT) {
+ if (head == NULL) {
head_index = i;
head = pt;
}
- else
- {
+ else {
EditBone *bone = NULL;
EditBone *new_parent;
- if (i - head_index > 1)
- {
+ if (i - head_index > 1) {
SK_StrokeIterator sk_iter;
BArcIterator *iter = (BArcIterator*)&sk_iter;
initStrokeIterator(iter, stk, head_index, i);
- if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
- {
+ if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE) {
bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision);
}
- else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
- {
+ else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH) {
bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision);
}
- else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
- {
+ else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED) {
bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision);
}
}
- if (bone == NULL)
- {
+ if (bone == NULL) {
bone = ED_armature_edit_bone_add(arm, "Bone");
copy_v3_v3(bone->head, head->p);
@@ -1548,14 +1413,12 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk)
bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
/* move to end of chain */
- while (bone->parent != NULL)
- {
+ while (bone->parent != NULL) {
bone = bone->parent;
bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
}
- if (parent != NULL)
- {
+ if (parent != NULL) {
bone->parent = parent;
bone->flag |= BONE_CONNECTED;
}
@@ -1573,16 +1436,12 @@ static void sk_convert(bContext *C, SK_Sketch *sketch)
ToolSettings *ts = CTX_data_tool_settings(C);
SK_Stroke *stk;
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
- if (stk->selected == 1)
- {
- if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
+ if (stk->selected == 1) {
+ if (ts->bone_sketching_convert == SK_CONVERT_RETARGET) {
sk_retargetStroke(C, stk);
}
- else
- {
+ else {
sk_convertStroke(C, stk);
}
// XXX
@@ -1600,8 +1459,7 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu
int added = 0;
int s_i;
- for (s_i = 0; s_i < gesture->nb_points - 1; s_i++)
- {
+ for (s_i = 0; s_i < gesture->nb_points - 1; s_i++) {
float s_p1[3] = {0, 0, 0};
float s_p2[3] = {0, 0, 0};
int g_i;
@@ -1610,8 +1468,7 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu
project_float(ar, gesture->points[s_i + 1].p, s_p2);
/* start checking from second next, because two consecutive cannot intersect */
- for (g_i = s_i + 2; g_i < gesture->nb_points - 1; g_i++)
- {
+ for (g_i = s_i + 2; g_i < gesture->nb_points - 1; g_i++) {
float g_p1[3] = {0, 0, 0};
float g_p2[3] = {0, 0, 0};
float vi[3];
@@ -1620,8 +1477,7 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu
project_float(ar, gesture->points[g_i].p, g_p1);
project_float(ar, gesture->points[g_i + 1].p, g_p2);
- if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
- {
+ if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
isect->gesture_index = g_i;
@@ -1647,24 +1503,18 @@ static int cmpIntersections(void *i1, void *i2)
{
SK_Intersection *isect1 = i1, *isect2 = i2;
- if (isect1->stroke == isect2->stroke)
- {
- if (isect1->before < isect2->before)
- {
+ if (isect1->stroke == isect2->stroke) {
+ if (isect1->before < isect2->before) {
return -1;
}
- else if (isect1->before > isect2->before)
- {
+ else if (isect1->before > isect2->before) {
return 1;
}
- else
- {
- if (isect1->lambda < isect2->lambda)
- {
+ else {
+ if (isect1->lambda < isect2->lambda) {
return -1;
}
- else if (isect1->lambda > isect2->lambda)
- {
+ else if (isect1->lambda > isect2->lambda) {
return 1;
}
}
@@ -1683,13 +1533,11 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
SK_Stroke *stk;
int added = 0;
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
int s_added = 0;
int s_i;
- for (s_i = 0; s_i < stk->nb_points - 1; s_i++)
- {
+ for (s_i = 0; s_i < stk->nb_points - 1; s_i++) {
float s_p1[3] = {0, 0, 0};
float s_p2[3] = {0, 0, 0};
int g_i;
@@ -1697,8 +1545,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
project_float(ar, stk->points[s_i].p, s_p1);
project_float(ar, stk->points[s_i + 1].p, s_p2);
- for (g_i = 0; g_i < gesture->nb_points - 1; g_i++)
- {
+ for (g_i = 0; g_i < gesture->nb_points - 1; g_i++) {
float g_p1[3] = {0, 0, 0};
float g_p2[3] = {0, 0, 0};
float vi[3];
@@ -1707,8 +1554,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
project_float(ar, gesture->points[g_i].p, g_p1);
project_float(ar, gesture->points[g_i + 1].p, g_p2);
- if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
- {
+ if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
float ray_start[3], ray_end[3];
float mval[2];
@@ -1723,12 +1569,12 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
mval[1] = vi[1];
ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
- isect_line_line_v3( stk->points[s_i].p,
- stk->points[s_i + 1].p,
- ray_start,
- ray_end,
- isect->p,
- vi);
+ isect_line_line_v3(stk->points[s_i].p,
+ stk->points[s_i + 1].p,
+ ray_start,
+ ray_end,
+ isect->p,
+ vi);
BLI_addtail(list, isect);
@@ -1759,15 +1605,13 @@ static int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture)
initStrokeIterator(iter, gesture, 0, gesture->nb_points - 1);
- for (i = 1, j = 0; i < gesture->nb_points; i++)
- {
+ for (i = 1, j = 0; i < gesture->nb_points; i++) {
float n[3];
/* Calculate normal */
sub_v3_v3v3(n, gesture->points[i].p, vec);
- if (calcArcCorrelation(iter, j, i, vec, n) < CORRELATION_THRESHOLD)
- {
+ if (calcArcCorrelation(iter, j, i, vec, n) < CORRELATION_THRESHOLD) {
j = i - 1;
sk_appendStrokePoint(segments, &gesture->points[j]);
vec = segments->points[segments->nb_points - 1].p;
@@ -1782,8 +1626,7 @@ static int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture)
int sk_detectCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 1 && gest->nb_intersections == 1)
- {
+ if (gest->nb_segments == 1 && gest->nb_intersections == 1) {
return 1;
}
@@ -1794,8 +1637,7 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED
{
SK_Intersection *isect;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
SK_Point pt;
pt.type = PT_EXACT;
@@ -1809,8 +1651,7 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED
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)
- {
+ if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0) {
float s1[3], s2[3];
float angle;
@@ -1819,8 +1660,7 @@ int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
angle = RAD2DEGF(angle_v2v2(s1, s2));
- if (angle > 60 && angle < 120)
- {
+ if (angle > 60 && angle < 120) {
return 1;
}
}
@@ -1835,8 +1675,7 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
sub_v3_v3v3(trim_dir, gest->segments->points[2].p, gest->segments->points[1].p);
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
SK_Point pt;
float stroke_dir[3];
@@ -1848,14 +1687,12 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
sub_v3_v3v3(stroke_dir, isect->stroke->points[isect->after].p, isect->stroke->points[isect->before].p);
/* same direction, trim end */
- if (dot_v3v3(stroke_dir, trim_dir) > 0)
- {
+ if (dot_v3v3(stroke_dir, trim_dir) > 0) {
sk_replaceStrokePoint(isect->stroke, &pt, isect->after);
sk_trimStroke(isect->stroke, 0, isect->after);
}
/* else, trim start */
- else
- {
+ else {
sk_replaceStrokePoint(isect->stroke, &pt, isect->before);
sk_trimStroke(isect->stroke, isect->before, isect->stroke->nb_points - 1);
}
@@ -1865,15 +1702,12 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
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)
- {
+ if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1) {
SK_Intersection *isect, *self_isect;
/* get the the last intersection of the first pair */
- for ( isect = gest->intersections.first; isect; isect = isect->next )
- {
- if (isect->stroke == isect->next->stroke)
- {
+ for ( isect = gest->intersections.first; isect; isect = isect->next ) {
+ if (isect->stroke == isect->next->stroke) {
isect = isect->next;
break;
}
@@ -1881,8 +1715,7 @@ int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
self_isect = gest->self_intersections.first;
- if (isect && isect->gesture_index < self_isect->gesture_index)
- {
+ if (isect && isect->gesture_index < self_isect->gesture_index) {
return 1;
}
}
@@ -1899,16 +1732,13 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
// command = pupmenu("Action %t|Flatten %x1|Straighten %x2|Polygonize %x3");
if (command < 1) return;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
SK_Intersection *i2;
i2 = isect->next;
- if (i2 && i2->stroke == isect->stroke)
- {
- switch (command)
- {
+ if (i2 && i2->stroke == isect->stroke) {
+ switch (command) {
case 1:
sk_flattenStroke(isect->stroke, isect->before, i2->after);
break;
@@ -1927,8 +1757,7 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 2 && gest->nb_intersections == 2)
- {
+ if (gest->nb_segments == 2 && gest->nb_intersections == 2) {
float s1[3], s2[3];
float angle;
@@ -1937,8 +1766,7 @@ int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNU
angle = RAD2DEGF(angle_v2v2(s1, s2));
- if (angle > 120)
- {
+ if (angle > 120) {
return 1;
}
}
@@ -1950,11 +1778,9 @@ void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *ske
{
SK_Intersection *isect;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only delete strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
isect = isect->next;
sk_removeStroke(sketch, isect->stroke);
@@ -1965,8 +1791,7 @@ void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *ske
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)
- {
+ if (gest->nb_segments > 2 && gest->nb_intersections == 2) {
short start_val[2], end_val[2];
short dist;
@@ -1976,26 +1801,21 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketc
dist = MAX2(ABS(start_val[0] - end_val[0]), ABS(start_val[1] - end_val[1]));
/* if gesture is a circle */
- if ( dist <= 20 )
- {
+ if ( dist <= 20 ) {
SK_Intersection *isect;
/* check if it circled around an exact point */
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only delete strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
int start_index, end_index;
int i;
start_index = MIN2(isect->after, isect->next->after);
end_index = MAX2(isect->before, isect->next->before);
- for (i = start_index; i <= end_index; i++)
- {
- if (isect->stroke->points[i].type == PT_EXACT)
- {
+ for (i = start_index; i <= end_index; i++) {
+ if (isect->stroke->points[i].type == PT_EXACT) {
return 1; /* at least one exact point found, stop detect here */
}
}
@@ -2015,22 +1835,18 @@ void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUS
SK_Intersection *isect;
/* check if it circled around an exact point */
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only merge strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
int start_index, end_index;
int i;
start_index = MIN2(isect->after, isect->next->after);
end_index = MAX2(isect->before, isect->next->before);
- for (i = start_index; i <= end_index; i++)
- {
+ for (i = start_index; i <= end_index; i++) {
/* if exact, switch to continuous */
- if (isect->stroke->points[i].type == PT_EXACT)
- {
+ if (isect->stroke->points[i].type == PT_EXACT) {
isect->stroke->points[i].type = PT_CONTINUOUS;
}
}
@@ -2043,34 +1859,28 @@ void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUS
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)
- {
+ if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0) {
SK_Intersection *isect;
/* check if it circled around an exact point */
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only delete strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
float start_v[3], end_v[3];
float angle;
- if (isect->gesture_index < isect->next->gesture_index)
- {
+ if (isect->gesture_index < isect->next->gesture_index) {
sub_v3_v3v3(start_v, isect->p, gest->stk->points[0].p);
sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->next->p);
}
- else
- {
+ else {
sub_v3_v3v3(start_v, isect->next->p, gest->stk->points[0].p);
sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->p);
}
angle = RAD2DEGF(angle_v2v2(start_v, end_v));
- if (angle > 120)
- {
+ if (angle > 120) {
return 1;
}
@@ -2087,11 +1897,9 @@ void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
{
SK_Intersection *isect;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only reverse strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
sk_reverseStroke(isect->stroke);
/* skip next */
@@ -2102,8 +1910,7 @@ void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
int sk_detectConvertGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 3 && gest->nb_self_intersections == 1)
- {
+ if (gest->nb_segments == 3 && gest->nb_self_intersections == 1) {
return 1;
}
return 0;
@@ -2142,10 +1949,8 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch)
sk_initGesture(C, &gest, sketch);
/* detect and apply */
- for (act = GESTURE_ACTIONS; act->apply != NULL; act++)
- {
- if (act->detect(C, &gest, sketch))
- {
+ for (act = GESTURE_ACTIONS; act->apply != NULL; act++) {
+ if (act->detect(C, &gest, sketch)) {
act->apply(C, &gest, sketch);
break;
}
@@ -2173,8 +1978,7 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
- if (hits>0)
- {
+ if (hits>0) {
int besthitresult = -1;
if (hits == 1) {
@@ -2185,18 +1989,15 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
/* loop and get best hit */
}
- if (besthitresult > 0)
- {
+ if (besthitresult > 0) {
SK_Stroke *selected_stk = BLI_findlink(&sketch->strokes, besthitresult - 1);
- if (extend == 0)
- {
+ if (extend == 0) {
sk_selectAllSketch(sketch, -1);
selected_stk->selected = 1;
}
- else
- {
+ else {
selected_stk->selected ^= 1;
}
@@ -2232,50 +2033,41 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
- if (with_names)
- {
+ if (with_names) {
int id;
- for (id = 1, stk = sketch->strokes.first; stk; id++, stk = stk->next)
- {
+ for (id = 1, stk = sketch->strokes.first; stk; id++, stk = stk->next) {
sk_drawStroke(stk, id, NULL, -1, -1);
}
glLoadName(-1);
}
- else
- {
+ else {
float selected_rgb[3] = {1, 0, 0};
float unselected_rgb[3] = {1, 0.5, 0};
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
int start = -1;
int end = -1;
- if (sk_hasOverdraw(sketch, stk))
- {
+ if (sk_hasOverdraw(sketch, stk)) {
sk_adjustIndexes(sketch, &start, &end);
}
sk_drawStroke(stk, -1, (stk->selected==1?selected_rgb:unselected_rgb), start, end);
- if (stk->selected == 1)
- {
+ if (stk->selected == 1) {
sk_drawStrokeSubdivision(ts, stk);
}
}
- if (sketch->active_stroke != NULL)
- {
+ if (sketch->active_stroke != NULL) {
SK_Point *last = sk_lastStrokePoint(sketch->active_stroke);
- if (ts->bone_sketching & BONE_SKETCHING_QUICK)
- {
+ if (ts->bone_sketching & BONE_SKETCHING_QUICK) {
sk_drawStrokeSubdivision(ts, sketch->active_stroke);
}
- if (last != NULL)
- {
+ if (last != NULL) {
GLUquadric *quad = gluNewQuadric();
gluQuadricNormals(quad, GLU_SMOOTH);
@@ -2284,8 +2076,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- switch (sketch->next_point.mode)
- {
+ switch (sketch->next_point.mode) {
case PT_SNAP:
glColor3f(0, 1, 0);
break;
@@ -2345,8 +2136,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
glDisable(GL_DEPTH_TEST);
/* only draw gesture in active area */
- if (sketch->gesture != NULL /*&& area_is_active_area(G.vd->area)*/)
- {
+ if (sketch->gesture != NULL /* && area_is_active_area(G.vd->area) */) {
float gesture_rgb[3] = {0, 0.5, 1};
sk_drawStroke(sketch->gesture, -1, gesture_rgb, -1, -1);
}
@@ -2356,20 +2146,16 @@ static int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (sketch->active_stroke != NULL)
- {
+ if (sketch->active_stroke != NULL) {
SK_Stroke *stk = sketch->active_stroke;
sk_endStroke(C, sketch);
- if (ts->bone_sketching & BONE_SKETCHING_QUICK)
- {
- if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
- {
+ if (ts->bone_sketching & BONE_SKETCHING_QUICK) {
+ if (ts->bone_sketching_convert == SK_CONVERT_RETARGET) {
sk_retargetStroke(C, stk);
}
- else
- {
+ else {
sk_convertStroke(C, stk);
}
// XXX
@@ -2389,8 +2175,7 @@ static int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
static void sk_start_draw_stroke(SK_Sketch *sketch)
{
- if (sketch->active_stroke == NULL)
- {
+ if (sketch->active_stroke == NULL) {
sk_startStroke(sketch);
sk_selectAllSketch(sketch, -1);
@@ -2405,8 +2190,7 @@ static void sk_start_draw_gesture(SK_Sketch *sketch)
static int sk_draw_stroke(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap)
{
- if (sk_stroke_filtermval(dd))
- {
+ if (sk_stroke_filtermval(dd)) {
sk_addStrokePoint(C, sketch, stk, dd, snap);
sk_updateDrawData(dd);
sk_updateNextPoint(sketch, stk);
@@ -2428,19 +2212,16 @@ static int ValidSketchViewContext(ViewContext *vc)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
int BDR_drawSketchNames(ViewContext *vc)
{
- if (ValidSketchViewContext(vc))
- {
+ if (ValidSketchViewContext(vc)) {
SK_Sketch *sketch = viewcontextSketch(vc, 0);
- if (sketch)
- {
+ if (sketch) {
sk_drawSketch(vc->scene, vc->v3d, sketch, 1);
return 1;
}
@@ -2451,11 +2232,9 @@ int BDR_drawSketchNames(ViewContext *vc)
void BDR_drawSketch(const bContext *C)
{
- if (ED_operator_sketch_mode(C))
- {
+ if (ED_operator_sketch_mode(C)) {
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_drawSketch(CTX_data_scene(C), CTX_wm_view3d(C), sketch, 0);
}
}
@@ -2464,8 +2243,7 @@ void BDR_drawSketch(const bContext *C)
static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_deleteSelectedStrokes(sketch);
// allqueue(REDRAWVIEW3D, 0);
}
@@ -2478,8 +2256,7 @@ void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend)
ToolSettings *ts = CTX_data_tool_settings(C);
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL && ts->bone_sketching & BONE_SKETCHING)
- {
+ if (sketch != NULL && ts->bone_sketching & BONE_SKETCHING) {
if (sk_selectStroke(C, sketch, mval, extend))
ED_area_tag_redraw(CTX_wm_area(C));
}
@@ -2487,11 +2264,9 @@ void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend)
void BIF_convertSketch(bContext *C)
{
- if (ED_operator_sketch_full_mode(C))
- {
+ if (ED_operator_sketch_full_mode(C)) {
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_convert(C, sketch);
// BIF_undo_push("Convert Sketch");
// allqueue(REDRAWVIEW3D, 0);
@@ -2502,11 +2277,9 @@ void BIF_convertSketch(bContext *C)
void BIF_deleteSketch(bContext *C)
{
- if (ED_operator_sketch_full_mode(C))
- {
+ if (ED_operator_sketch_full_mode(C)) {
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_deleteSelectedStrokes(sketch);
// BIF_undo_push("Convert Sketch");
// allqueue(REDRAWVIEW3D, 0);
@@ -2535,12 +2308,10 @@ SK_Sketch* contextSketch(const bContext *C, int create)
Object *obedit = CTX_data_edit_object(C);
SK_Sketch *sketch = NULL;
- if (obedit && obedit->type == OB_ARMATURE)
- {
+ if (obedit && obedit->type == OB_ARMATURE) {
bArmature *arm = obedit->data;
- if (arm->sketch == NULL && create)
- {
+ if (arm->sketch == NULL && create) {
arm->sketch = createSketch();
}
sketch = arm->sketch;
@@ -2554,12 +2325,10 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create)
Object *obedit = vc->obedit;
SK_Sketch *sketch = NULL;
- if (obedit && obedit->type == OB_ARMATURE)
- {
+ if (obedit && obedit->type == OB_ARMATURE) {
bArmature *arm = obedit->data;
- if (arm->sketch == NULL && create)
- {
+ if (arm->sketch == NULL && create) {
arm->sketch = createSketch();
}
sketch = arm->sketch;
@@ -2571,8 +2340,7 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create)
static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL)
- {
+ if (sketch != NULL) {
sk_convert(C, sketch);
ED_area_tag_redraw(CTX_wm_area(C));
}
@@ -2582,8 +2350,7 @@ static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e
static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL)
- {
+ if (sketch != NULL) {
sk_cancelStroke(sketch);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
@@ -2594,10 +2361,8 @@ static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev
static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL)
- {
- if (sk_finish_stroke(C, sketch))
- {
+ if (sketch != NULL) {
+ if (sk_finish_stroke(C, sketch)) {
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
@@ -2608,8 +2373,7 @@ static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev
static int sketch_select(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
short extend = 0;
if (sk_selectStroke(C, sketch, event->mval, extend))
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2677,8 +2441,7 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */
int retval = OPERATOR_RUNNING_MODAL;
- switch (event->type)
- {
+ switch (event->type) {
case LEFTCTRLKEY:
case RIGHTCTRLKEY:
snap = event->ctrl;
@@ -2697,10 +2460,8 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
retval = OPERATOR_CANCELLED;
break;
case LEFTMOUSE:
- if (event->val == KM_RELEASE)
- {
- if (gesture == 0)
- {
+ if (event->val == KM_RELEASE) {
+ if (gesture == 0) {
sk_endContinuousStroke(stk);
sk_filterLastContinuousStroke(stk);
sk_updateNextPoint(sketch, stk);
@@ -2708,13 +2469,11 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
MEM_freeN(op->customdata);
retval = OPERATOR_FINISHED;
}
- else
- {
+ else {
sk_endContinuousStroke(stk);
sk_filterLastContinuousStroke(stk);
- if (stk->nb_points > 1)
- {
+ if (stk->nb_points > 1) {
/* apply gesture here */
sk_applyGesture(C, sketch);
}
@@ -2750,8 +2509,7 @@ static int sketch_draw_preview(bContext *C, wmOperator *op, wmEvent *event)
short snap = RNA_boolean_get(op->ptr, "snap");
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
SK_DrawData dd;
sk_initDrawData(&dd, event->mval);
@@ -2775,8 +2533,7 @@ int ED_operator_sketch_mode_active_stroke(bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -2793,8 +2550,7 @@ static int ED_operator_sketch_mode_gesture(bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -2811,8 +2567,7 @@ int ED_operator_sketch_full_mode(bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -2828,8 +2583,7 @@ int ED_operator_sketch_mode(const bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 59a7437e753..3828c025bcd 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -584,7 +584,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
v2= (*face)[1];
v3= (*face)[2];
- normal_tri_v3( fnor,sys->verts[v1], sys->verts[v2], sys->verts[v3]);
+ normal_tri_v3(fnor, sys->verts[v1], sys->verts[v2], sys->verts[v3]);
add_v3_v3(sys->heat.vnors[v1], fnor);
add_v3_v3(sys->heat.vnors[v2], fnor);
@@ -945,7 +945,7 @@ void rigid_deform_iteration()
}
}
- /* solve for positions, for X,Y and Z separately */
+ /* solve for positions, for X, Y and Z separately */
for (i=0; i<3; i++) {
laplacian_begin_solve(sys, i);
@@ -1069,7 +1069,7 @@ void rigid_deform_end(int cancel)
#define MESHDEFORM_MIN_INFLUENCE 0.0005f
static int MESHDEFORM_OFFSET[7][3] =
- {{0,0,0}, {1,0,0}, {-1,0,0}, {0,1,0}, {0,-1,0}, {0,0,1}, {0,0,-1}};
+ {{0, 0, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}};
typedef struct MDefBoundIsect {
float co[3], uvw[4];
@@ -1128,10 +1128,10 @@ typedef struct MeshDeformIsect {
/* our own triangle intersection, so we can fully control the epsilons and
* prevent corner case from going wrong*/
static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
- float vert1[3], float vert2[3], float *isectco, float *uvw)
+ float vert1[3], float vert2[3], float *isectco, float *uvw)
{
float edge1[3], edge2[3], tvec[3], pvec[3], qvec[3];
- float det,inv_det, u, v, dir[3], isectdir[3];
+ float det, inv_det, u, v, dir[3], isectdir[3];
sub_v3_v3v3(dir, end, orig);
@@ -1208,16 +1208,16 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
hit = meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
if (hit) {
- normal_tri_v3( nor,face[0], face[1], face[2]);
+ normal_tri_v3(nor, face[0], face[1], face[2]);
}
else {
hit= meshdeform_tri_intersect(isec->start, end, face[0], face[2], face[3], co, uvw);
- normal_tri_v3( nor,face[0], face[2], face[3]);
+ normal_tri_v3(nor, face[0], face[2], face[3]);
}
}
else {
hit= meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
- normal_tri_v3( nor,face[0], face[1], face[2]);
+ normal_tri_v3(nor, face[0], face[1], face[2]);
}
if (hit) {
@@ -1281,7 +1281,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
copy_v3_v3(vert[1], cagecos[mface->v2]);
copy_v3_v3(vert[2], cagecos[mface->v3]);
if (mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
- interp_weights_poly_v3( isect->uvw,vert, isect->nvert, isect->co);
+ interp_weights_poly_v3(isect->uvw, vert, isect->nvert, isect->co);
return isect;
}
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index be520d1e8a0..40dc0a7cd36 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -433,7 +433,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {
/* calculate the interpolation between the endpoints */
- interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame) );
+ interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame));
/* make a copy of the original rotation */
copy_qt_qt(quat_orig, pchan->quat);
@@ -759,7 +759,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op)
return pose_slide_exec_common(C, op, pso);
}
-void POSE_OT_push (wmOperatorType *ot)
+void POSE_OT_push(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Push Pose";
@@ -816,7 +816,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op)
return pose_slide_exec_common(C, op, pso);
}
-void POSE_OT_relax (wmOperatorType *ot)
+void POSE_OT_relax(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Relax Pose";
@@ -873,7 +873,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
return pose_slide_exec_common(C, op, pso);
}
-void POSE_OT_breakdown (wmOperatorType *ot)
+void POSE_OT_breakdown(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Pose Breakdowner";
@@ -1228,7 +1228,7 @@ static int pose_propagate_exec (bContext *C, wmOperator *op)
/* --------------------------------- */
-void POSE_OT_propagate (wmOperatorType *ot)
+void POSE_OT_propagate(wmOperatorType *ot)
{
static EnumPropertyItem terminate_items[]= {
{POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behavior)"},
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index 1a9ff73e5dc..c32655fb680 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -126,13 +126,12 @@ static void fcurves_to_pchan_links_get (ListBase *pfLinks, Object *ob, bAction *
/* get sets of F-Curves providing transforms for the bones in the Pose */
-void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *act)
+void poseAnim_mapping_get(bContext *C, ListBase *pfLinks, Object *ob, bAction *act)
{
/* for each Pose-Channel which gets affected, get the F-Curves for that channel
* and set the relevant transform flags...
*/
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);
}
CTX_DATA_END;
@@ -141,8 +140,7 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
* i.e. if nothing selected, do whole pose
*/
if (pfLinks->first == NULL) {
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, visible_pose_bones) {
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);
}
CTX_DATA_END;
@@ -150,7 +148,7 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
}
/* free F-Curve <-> PoseChannel links */
-void poseAnim_mapping_free (ListBase *pfLinks)
+void poseAnim_mapping_free(ListBase *pfLinks)
{
tPChanFCurveLink *pfl, *pfln=NULL;
@@ -178,7 +176,7 @@ void poseAnim_mapping_free (ListBase *pfLinks)
/* ------------------------- */
/* helper for apply() / reset() - refresh the data */
-void poseAnim_mapping_refresh (bContext *C, Scene *scene, Object *ob)
+void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
{
bArmature *arm= (bArmature *)ob->data;
@@ -196,7 +194,7 @@ void poseAnim_mapping_refresh (bContext *C, Scene *scene, Object *ob)
}
/* reset changes made to current pose */
-void poseAnim_mapping_reset (ListBase *pfLinks)
+void poseAnim_mapping_reset(ListBase *pfLinks)
{
tPChanFCurveLink *pfl;
@@ -219,7 +217,7 @@ void poseAnim_mapping_reset (ListBase *pfLinks)
}
/* perform autokeyframing after changes were made + confirmed */
-void poseAnim_mapping_autoKeyframe (bContext *C, Scene *scene, Object *ob, ListBase *pfLinks, float cframe)
+void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, Object *ob, ListBase *pfLinks, float cframe)
{
/* insert keyframes as necessary if autokeyframing */
if (autokeyframe_cfra_can_key(scene, &ob->id)) {
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 2799d7994bc..8791a345489 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -232,7 +232,7 @@ static int poselib_new_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSELIB_OT_new (wmOperatorType *ot)
+void POSELIB_OT_new(wmOperatorType *ot)
{
/* identifiers */
ot->name = "New Pose Library";
@@ -267,7 +267,7 @@ static int poselib_unlink_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSELIB_OT_unlink (wmOperatorType *ot)
+void POSELIB_OT_unlink(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Unlink Pose Library";
@@ -353,7 +353,7 @@ static int poselib_sanitise_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_action_sanitise (wmOperatorType *ot)
+void POSELIB_OT_action_sanitise(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sanitise Pose Library Action";
@@ -483,7 +483,7 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_pose_add (wmOperatorType *ot)
+void POSELIB_OT_pose_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "PoseLib Add Pose";
@@ -597,7 +597,7 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_pose_remove (wmOperatorType *ot)
+void POSELIB_OT_pose_remove(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -684,7 +684,7 @@ static int poselib_rename_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_pose_rename (wmOperatorType *ot)
+void POSELIB_OT_pose_rename(wmOperatorType *ot)
{
PropertyRNA *prop;
static EnumPropertyItem prop_poses_dummy_types[] = {
@@ -897,10 +897,12 @@ static void poselib_apply_pose (tPoseLib_PreviewData *pld)
}
else if (pchan->bone) {
/* only ok if bone is visible and selected */
- if ( (pchan->bone->flag & BONE_SELECTED) &&
- (pchan->bone->flag & BONE_HIDDEN_P)==0 &&
- (pchan->bone->layer & arm->layer) )
+ if ((pchan->bone->flag & BONE_SELECTED) &&
+ (pchan->bone->flag & BONE_HIDDEN_P) == 0 &&
+ (pchan->bone->layer & arm->layer))
+ {
ok = 1;
+ }
}
if (ok)
@@ -1620,7 +1622,7 @@ static int poselib_preview_exec (bContext *C, wmOperator *op)
return poselib_preview_exit(C, op);
}
-void POSELIB_OT_browse_interactive (wmOperatorType *ot)
+void POSELIB_OT_browse_interactive(wmOperatorType *ot)
{
/* identifiers */
ot->name = "PoseLib Browse Poses";
@@ -1646,7 +1648,7 @@ void POSELIB_OT_browse_interactive (wmOperatorType *ot)
/* RNA_def_float_factor(ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor", "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f); */
}
-void POSELIB_OT_apply_pose (wmOperatorType *ot)
+void POSELIB_OT_apply_pose(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Pose Library Pose";
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 043383d79a3..817a2da8325 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -216,8 +216,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* set up path data for bones being calculated */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* verify makes sure that the selected bone has a bone with the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, pchan);
}
@@ -233,7 +232,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_paths_calculate (wmOperatorType *ot)
+void POSE_OT_paths_calculate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Calculate Bone Paths";
@@ -301,7 +300,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_paths_clear (wmOperatorType *ot)
+void POSE_OT_paths_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Bone Paths";
@@ -324,8 +323,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
bConstraint *con;
int found= 0;
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if (pchan->bone->flag & BONE_SELECTED) {
for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -387,8 +385,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
int add_to_sel = RNA_boolean_get(op->ptr, "extend");
int found= 0;
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
curbone= pchan->bone;
if ((curbone->flag & BONE_UNSELECTABLE)==0) {
@@ -505,8 +502,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
*/
group_flags= MEM_callocN(numGroups+1, "pose_select_same_group");
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* keep track of group as group to use later? */
if (pchan->bone->flag & BONE_SELECTED) {
group_flags[pchan->agrp_index] = 1;
@@ -522,8 +518,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
/* small optimization: only loop through bones a second time if there are any groups tagged */
if (tagged) {
/* only if group matches (and is not selected or current bone) */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
/* check if the group used by this bone is counted */
if (group_flags[pchan->agrp_index]) {
@@ -552,8 +547,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
return 0;
/* figure out what bones are selected */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* keep track of layers to use later? */
if (pchan->bone->flag & BONE_SELECTED)
layers |= pchan->bone->layer;
@@ -567,8 +561,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
return 0;
/* select bones that are on same layers as layers flag */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* if bone is on a suitable layer, and the bone can have its selection changed, select it */
if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
pchan->bone->flag |= BONE_SELECTED;
@@ -598,8 +591,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
/* if not extending selection, deselect all selected first */
if (extend == 0) {
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0)
pchan->bone->flag &= ~BONE_SELECTED;
}
@@ -673,7 +665,7 @@ static int pose_select_grouped_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-void POSE_OT_select_grouped (wmOperatorType *ot)
+void POSE_OT_select_grouped(wmOperatorType *ot)
{
static EnumPropertyItem prop_select_grouped_types[] = {
{0, "LAYER", 0, "Layer", "Shared layers"},
@@ -800,7 +792,7 @@ static void pose_copy_menu(Scene *scene)
if (nr != 5) {
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ( (arm->layer & pchan->bone->layer) &&
+ if ((arm->layer & pchan->bone->layer) &&
(pchan->bone->flag & BONE_SELECTED) &&
(pchan != pchanact) )
{
@@ -869,13 +861,13 @@ static void pose_copy_menu(Scene *scene)
float tmp_quat[4];
/* need to convert to quat first (in temp var)... */
- mat4_to_quat( tmp_quat,delta_mat);
- quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,tmp_quat);
+ mat4_to_quat(tmp_quat, delta_mat);
+ quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, tmp_quat);
}
else if (pchan->rotmode == ROT_MODE_QUAT)
- mat4_to_quat( pchan->quat,delta_mat);
+ mat4_to_quat(pchan->quat, delta_mat);
else
- mat4_to_eulO( pchan->eul, pchan->rotmode,delta_mat);
+ mat4_to_eulO(pchan->eul, pchan->rotmode, delta_mat);
}
break;
case 11: /* Visual Size */
@@ -883,7 +875,7 @@ static void pose_copy_menu(Scene *scene)
float delta_mat[4][4], size[4];
armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- mat4_to_size( size,delta_mat);
+ mat4_to_size(size, delta_mat);
copy_v3_v3(pchan->size, size);
}
}
@@ -922,7 +914,7 @@ static void pose_copy_menu(Scene *scene)
/* Copy the temo listbase to the selected posebones */
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ( (arm->layer & pchan->bone->layer) &&
+ if ((arm->layer & pchan->bone->layer) &&
(pchan->bone->flag & BONE_SELECTED) &&
(pchan!=pchanact) )
{
@@ -1058,9 +1050,9 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s
else if (pchan->rotmode > 0) {
/* quat/axis-angle to euler */
if (chan->rotmode == ROT_MODE_AXISANGLE)
- axis_angle_to_eulO( pchan->eul, pchan->rotmode,chan->rotAxis, chan->rotAngle);
+ axis_angle_to_eulO(pchan->eul, pchan->rotmode, chan->rotAxis, chan->rotAngle);
else
- quat_to_eulO( pchan->eul, pchan->rotmode,chan->quat);
+ quat_to_eulO(pchan->eul, pchan->rotmode, chan->quat);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
/* quat/euler to axis angle */
@@ -1148,7 +1140,7 @@ static int pose_copy_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_copy (wmOperatorType *ot)
+void POSE_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Pose";
@@ -1215,7 +1207,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_paste (wmOperatorType *ot)
+void POSE_OT_paste(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1265,7 +1257,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_add (wmOperatorType *ot)
+void POSE_OT_group_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Bone Group";
@@ -1305,7 +1297,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_remove (wmOperatorType *ot)
+void POSE_OT_group_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Bone Group";
@@ -1403,8 +1395,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
pose_add_group(ob);
/* add selected bones to group then */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
pchan->agrp_index= pose->active_group;
done= 1;
}
@@ -1420,7 +1411,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-void POSE_OT_group_assign (wmOperatorType *ot)
+void POSE_OT_group_assign(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Selected to Bone Group";
@@ -1457,8 +1448,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* find selected bones to remove from all bone groups */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
if (pchan->agrp_index) {
pchan->agrp_index= 0;
done= 1;
@@ -1476,7 +1466,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
-void POSE_OT_group_unassign (wmOperatorType *ot)
+void POSE_OT_group_unassign(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Selected from Bone Groups";
@@ -1660,8 +1650,7 @@ static void pose_group_select(bContext *C, Object *ob, int select)
{
bPose *pose= ob->pose;
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
if (select) {
if (pchan->agrp_index == pose->active_group)
@@ -1699,7 +1688,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_select (wmOperatorType *ot)
+void POSE_OT_group_select(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Bones of Bone Group";
@@ -1737,7 +1726,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_deselect (wmOperatorType *ot)
+void POSE_OT_group_deselect(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Deselect Bone Group";
@@ -1765,8 +1754,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
char newname[MAXBONENAME];
flip_side_name(newname, pchan->name, TRUE);
ED_armature_bone_rename(arm, pchan->name, newname);
@@ -1782,7 +1770,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_flip_names (wmOperatorType *ot)
+void POSE_OT_flip_names(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Names";
@@ -1812,8 +1800,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
BLI_strncpy(newname, pchan->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
ED_armature_bone_rename(arm, pchan->name, newname);
@@ -1829,7 +1816,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_autoside_names (wmOperatorType *ot)
+void POSE_OT_autoside_names(wmOperatorType *ot)
{
static EnumPropertyItem axis_items[]= {
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
@@ -1862,8 +1849,7 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
int mode = RNA_enum_get(op->ptr, "type");
/* set rotation mode of selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
pchan->rotmode = mode;
}
CTX_DATA_END;
@@ -1875,7 +1861,7 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_rotation_mode_set (wmOperatorType *ot)
+void POSE_OT_rotation_mode_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Rotation Mode";
@@ -1934,7 +1920,7 @@ static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
+void ARMATURE_OT_layers_show_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Show All Layers";
@@ -2000,7 +1986,7 @@ static int pose_armature_layers_exec (bContext *C, wmOperator *op)
}
-void POSE_OT_armature_layers (wmOperatorType *ot)
+void POSE_OT_armature_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Armature Layers";
@@ -2019,7 +2005,7 @@ void POSE_OT_armature_layers (wmOperatorType *ot)
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
}
-void ARMATURE_OT_armature_layers (wmOperatorType *ot)
+void ARMATURE_OT_armature_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Armature Layers";
@@ -2046,8 +2032,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
int layers[32]= {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
short bit;
/* loop over the bits for this pchan's layers, adding layers where they're needed */
@@ -2080,8 +2065,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
RNA_boolean_get_array(op->ptr, "layers", layers);
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
/* get pointer for pchan, and write flags this way */
RNA_pointer_create((ID *)ob->data, &RNA_Bone, pchan->bone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
@@ -2094,7 +2078,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_bone_layers (wmOperatorType *ot)
+void POSE_OT_bone_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Bone Layers";
@@ -2121,8 +2105,7 @@ static int armature_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
int layers[32]= {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
short bit;
/* loop over the bits for this pchan's layers, adding layers where they're needed */
@@ -2152,8 +2135,7 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
RNA_boolean_get_array(op->ptr, "layers", layers);
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
/* get pointer for pchan, and write flags this way */
RNA_pointer_create((ID *)arm, &RNA_EditBone, ebone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
@@ -2166,7 +2148,7 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_bone_layers (wmOperatorType *ot)
+void ARMATURE_OT_bone_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Bone Layers";
@@ -2195,8 +2177,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
/* loop through all selected pchans, flipping and keying (as needed) */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* only if bone is using quaternion rotation */
if (pchan->rotmode == ROT_MODE_QUAT) {
/* quaternions have 720 degree range */
@@ -2214,7 +2195,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_quaternions_flip (wmOperatorType *ot)
+void POSE_OT_quaternions_flip(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Quats";
@@ -2290,7 +2271,7 @@ static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_user_transforms_clear (wmOperatorType *ot)
+void POSE_OT_user_transforms_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear User Transforms";
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 546bcb1f40f..efcbab78884 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -41,7 +41,6 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_ghash.h"
#include "BLI_heap.h"
@@ -81,15 +80,23 @@ static ReebGraph *FILTERED_RG = NULL;
#define DEBUG_REEB
#define DEBUG_REEB_NODE
-typedef struct VertexData
-{
+/* place-holders! */
+typedef struct EditEdge {
+ void *fake;
+} EditEdge;
+
+typedef struct EditFace {
+ void *fake;
+} EditFace;
+/* end place-holders! */
+
+typedef struct VertexData {
float w; /* weight */
int i; /* index */
ReebNode *n;
} VertexData;
-typedef struct EdgeIndex
-{
+typedef struct EdgeIndex {
EditEdge **edges;
int *offset;
} EdgeIndex;
@@ -183,16 +190,14 @@ void REEB_freeGraph(ReebGraph *rg)
ReebNode *node;
// free nodes
- for ( node = rg->nodes.first; node; node = node->next )
- {
+ for (node = rg->nodes.first; node; node = node->next) {
BLI_freeNode((BGraph*)rg, (BNode*)node);
}
BLI_freelistN(&rg->nodes);
// free arcs
arc = rg->arcs.first;
- while ( arc )
- {
+ while (arc) {
ReebArc *next = arc->next;
REEB_freeArc((BArc*)arc);
arc = next;
@@ -202,8 +207,7 @@ void REEB_freeGraph(ReebGraph *rg)
BLI_edgehash_free(rg->emap, NULL);
/* free linked graph */
- if (rg->link_up)
- {
+ if (rg->link_up) {
REEB_freeGraph(rg->link_up);
}
@@ -229,8 +233,7 @@ ReebGraph * newReebGraph(void)
void BIF_flagMultiArcs(ReebGraph *rg, int flag)
{
- for ( ; rg; rg = rg->link_up)
- {
+ for ( ; rg; rg = rg->link_up) {
BLI_flagArcs((BGraph*)rg, flag);
}
}
@@ -318,8 +321,7 @@ ReebNode *BIF_NodeFromIndex(ReebArc *arc, ReebNode *node)
ReebNode *BIF_lowestLevelNode(ReebNode *node)
{
- while (node->link_down)
- {
+ while (node->link_down) {
node = node->link_down;
}
@@ -407,8 +409,7 @@ ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node)
{
ReebGraph *multi_rg = rg;
- while (multi_rg && multi_rg->multi_level != node->multi_level)
- {
+ while (multi_rg && multi_rg->multi_level != node->multi_level) {
multi_rg = multi_rg->link_up;
}
@@ -484,15 +485,12 @@ void repositionNodes(ReebGraph *rg)
BNode *node = NULL;
// Reset node positions
- for (node = rg->nodes.first; node; node = node->next)
- {
+ for (node = rg->nodes.first; node; node = node->next) {
node->p[0] = node->p[1] = node->p[2] = 0;
}
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (((ReebArc*)arc)->bcount > 0)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (((ReebArc*)arc)->bcount > 0) {
float p[3];
copy_v3_v3(p, ((ReebArc*)arc)->buckets[0].p);
@@ -512,22 +510,17 @@ void verifyNodeDegree(ReebGraph *rg)
ReebNode *node = NULL;
ReebArc *arc = NULL;
- for (node = rg->nodes.first; node; node = node->next)
- {
+ for (node = rg->nodes.first; node; node = node->next) {
int count = 0;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head == node || arc->tail == node)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head == node || arc->tail == node) {
count++;
}
}
- if (count != node->degree)
- {
+ if (count != node->degree) {
printf("degree error in node %i: expected %i got %i\n", node->index, count, node->degree);
}
- if (node->degree == 0)
- {
+ if (node->degree == 0) {
printf("zero degree node %i with weight %f\n", node->index, node->weight);
}
}
@@ -539,25 +532,20 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
ReebNode *head = (ReebNode*)arc->head;
ReebNode *tail = (ReebNode*)arc->tail;
- if (arc->bcount > 0)
- {
+ if (arc->bcount > 0) {
int i;
- for (i = 0; i < arc->bcount; i++)
- {
- if (arc->buckets[i].nv == 0)
- {
+ for (i = 0; i < arc->bcount; i++) {
+ if (arc->buckets[i].nv == 0) {
printArc(arc);
printf("count error in bucket %i/%i\n", i+1, arc->bcount);
}
}
- if (ceilf(head->weight) != arc->buckets[0].val)
- {
+ if (ceilf(head->weight) != arc->buckets[0].val) {
printArc(arc);
printf("alloc error in first bucket: %f should be %f\n", arc->buckets[0].val, ceil(head->weight));
}
- if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val)
- {
+ if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val) {
printArc(arc);
printf("alloc error in last bucket: %f should be %f\n", arc->buckets[arc->bcount - 1].val, floor(tail->weight));
}
@@ -568,8 +556,7 @@ void verifyBuckets(ReebGraph *rg)
{
#ifdef DEBUG_REEB
ReebArc *arc = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
verifyBucketsArc(rg, arc);
}
#endif
@@ -580,8 +567,7 @@ void verifyFaces(ReebGraph *rg)
#ifdef DEBUG_REEB
int total = 0;
ReebArc *arc = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
total += BLI_ghash_size(arc->faces);
}
@@ -592,10 +578,8 @@ void verifyArcs(ReebGraph *rg)
{
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head->weight > arc->tail->weight)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head->weight > arc->tail->weight) {
printf("FLIPPED ARC!\n");
}
}
@@ -606,14 +590,11 @@ static void verifyMultiResolutionLinks(ReebGraph *rg, int level)
#ifdef DEBUG_REEB
ReebGraph *lower_rg = rg->link_up;
- if (lower_rg)
- {
+ if (lower_rg) {
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (BLI_findindex(&lower_rg->arcs, arc->link_up) == -1)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (BLI_findindex(&lower_rg->arcs, arc->link_up) == -1) {
printf("missing arc %p for level %i\n", (void *)arc->link_up, level);
printf("Source arc was ---\n");
printArc(arc);
@@ -647,13 +628,11 @@ static void removeVertFromBucket(EmbedBucket *b, float co[3])
static void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
{
- if (bDst->nv > 0 && bSrc->nv > 0)
- {
+ if (bDst->nv > 0 && bSrc->nv > 0) {
bDst->nv += bSrc->nv;
interp_v3_v3v3(bDst->p, bDst->p, bSrc->p, (float)bSrc->nv / (float)(bDst->nv));
}
- else if (bSrc->nv > 0)
- {
+ else if (bSrc->nv > 0) {
bDst->nv = bSrc->nv;
copy_v3_v3(bDst->p, bSrc->p);
}
@@ -661,19 +640,16 @@ static void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
static void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end)
{
- if (aDst->bcount > 0 && aSrc->bcount > 0)
- {
+ if (aDst->bcount > 0 && aSrc->bcount > 0) {
int indexDst = 0, indexSrc = 0;
start = MAX3(start, aDst->buckets[0].val, aSrc->buckets[0].val);
- while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
- {
+ while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start) {
indexDst++;
}
- while (indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
- {
+ while (indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start) {
indexSrc++;
}
@@ -693,8 +669,7 @@ void flipArcBuckets(ReebArc *arc)
{
int i, j;
- for (i = 0, j = arc->bcount - 1; i < j; i++, j--)
- {
+ for (i = 0, j = arc->bcount - 1; i < j; i++, j--) {
EmbedBucket tmp;
tmp = arc->buckets[i];
@@ -714,20 +689,16 @@ static void allocArcBuckets(ReebArc *arc)
float start = ceil(arc->head->weight);
arc->bcount = countArcBuckets(arc);
- if (arc->bcount > 0)
- {
+ if (arc->bcount > 0) {
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "embed bucket");
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
arc->buckets[i].val = start + i;
}
}
- else
- {
+ else {
arc->buckets = NULL;
}
-
}
static void resizeArcBuckets(ReebArc *arc)
@@ -735,15 +706,13 @@ static void resizeArcBuckets(ReebArc *arc)
EmbedBucket *oldBuckets = arc->buckets;
int oldBCount = arc->bcount;
- if (countArcBuckets(arc) == oldBCount)
- {
+ if (countArcBuckets(arc) == oldBCount) {
return;
}
allocArcBuckets(arc);
- if (oldBCount != 0 && arc->bcount != 0)
- {
+ if (oldBCount != 0 && arc->bcount != 0) {
int oldStart = (int)oldBuckets[0].val;
int oldEnd = (int)oldBuckets[oldBCount - 1].val;
int newStart = (int)arc->buckets[0].val;
@@ -752,12 +721,10 @@ static void resizeArcBuckets(ReebArc *arc)
int newOffset = 0;
int len;
- if (oldStart < newStart)
- {
+ if (oldStart < newStart) {
oldOffset = newStart - oldStart;
}
- else
- {
+ else {
newOffset = oldStart - newStart;
}
@@ -766,8 +733,7 @@ static void resizeArcBuckets(ReebArc *arc)
memcpy(arc->buckets + newOffset, oldBuckets + oldOffset, len * sizeof(EmbedBucket));
}
- if (oldBuckets != NULL)
- {
+ if (oldBuckets != NULL) {
MEM_freeN(oldBuckets);
}
}
@@ -777,10 +743,8 @@ static void reweightBuckets(ReebArc *arc)
int i;
float start = ceil((arc->head)->weight);
- if (arc->bcount > 0)
- {
- for (i = 0; i < arc->bcount; i++)
- {
+ if (arc->bcount > 0) {
+ for (i = 0; i < arc->bcount; i++) {
arc->buckets[i].val = start + i;
}
}
@@ -793,8 +757,7 @@ static void interpolateBuckets(ReebArc *arc, float *start_p, float *end_p, int s
total = end_index - start_index + 2;
- for (j = start_index; j <= end_index; j++)
- {
+ for (j = start_index; j <= end_index; j++) {
EmbedBucket *empty = arc->buckets + j;
empty->nv = 1;
interp_v3_v3v3(empty->p, start_p, end_p, (float)(j - start_index + 1) / total);
@@ -810,14 +773,11 @@ static void fillArcEmptyBuckets(ReebArc *arc)
start_p = arc->head->p;
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
EmbedBucket *bucket = arc->buckets + i;
- if (missing)
- {
- if (bucket->nv > 0)
- {
+ if (missing) {
+ if (bucket->nv > 0) {
missing = 0;
end_p = bucket->p;
@@ -826,14 +786,11 @@ static void fillArcEmptyBuckets(ReebArc *arc)
interpolateBuckets(arc, start_p, end_p, start_index, end_index);
}
}
- else
- {
- if (bucket->nv == 0)
- {
+ else {
+ if (bucket->nv == 0) {
missing = 1;
- if (i > 0)
- {
+ if (i > 0) {
start_p = arc->buckets[i - 1].p;
}
start_index = i;
@@ -841,8 +798,7 @@ static void fillArcEmptyBuckets(ReebArc *arc)
}
}
- if (missing)
- {
+ if (missing) {
end_p = arc->tail->p;
end_index = arc->bcount - 1;
@@ -859,8 +815,7 @@ static void ExtendArcBuckets(ReebArc *arc)
float average_length = 0, length;
int padding_head = 0, padding_tail = 0;
- if (arc->bcount == 0)
- {
+ if (arc->bcount == 0) {
return; /* failsafe, shouldn't happen */
}
@@ -881,19 +836,16 @@ static void ExtendArcBuckets(ReebArc *arc)
last_bucket = arc->buckets + (arc->bcount - 1);
length = len_v3v3(first_bucket->p, arc->head->p);
- if (length > 2 * average_length)
- {
+ if (length > 2 * average_length) {
padding_head = (int)floor(length / average_length);
}
length = len_v3v3(last_bucket->p, arc->tail->p);
- if (length > 2 * average_length)
- {
+ if (length > 2 * average_length) {
padding_tail = (int)floor(length / average_length);
}
- if (padding_head + padding_tail > 0)
- {
+ if (padding_head + padding_tail > 0) {
EmbedBucket *old_buckets = arc->buckets;
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * (padding_head + arc->bcount + padding_tail), "embed bucket");
@@ -904,13 +856,11 @@ static void ExtendArcBuckets(ReebArc *arc)
MEM_freeN(old_buckets);
}
- if (padding_head > 0)
- {
+ if (padding_head > 0) {
interpolateBuckets(arc, arc->head->p, first_bucket->p, 0, padding_head);
}
- if (padding_tail > 0)
- {
+ if (padding_tail > 0) {
interpolateBuckets(arc, last_bucket->p, arc->tail->p, arc->bcount - padding_tail, arc->bcount - 1);
}
}
@@ -920,8 +870,7 @@ static void extendGraphBuckets(ReebGraph *rg)
{
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
ExtendArcBuckets(arc);
}
}
@@ -941,8 +890,7 @@ static void calculateArcLength(ReebArc *arc)
vec0 = arc->head->p;
vec1 = arc->head->p; /* in case there's no embedding */
- while (IT_next(iter))
- {
+ while (IT_next(iter)) {
vec1 = iter->p;
arc->length += len_v3v3(vec0, vec1);
@@ -957,8 +905,7 @@ static void calculateGraphLength(ReebGraph *rg)
{
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
calculateArcLength(arc);
}
}
@@ -975,8 +922,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
copy_v3_v3(axis, root_node->symmetry_axis);
/* first pass, merge incrementally */
- for (i = 0; i < count - 1; i++)
- {
+ for (i = 0; i < count - 1; i++) {
ReebNode *node1, *node2;
ReebArc *arc1, *arc2;
float tangent[3];
@@ -999,8 +945,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
/* Merge buckets
* there shouldn't be any null arcs here, but just to be safe
* */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
+ if (arc1->bcount > 0 && arc2->bcount > 0) {
ReebArcIterator arc_iter1, arc_iter2;
BArcIterator *iter1 = (BArcIterator*)&arc_iter1;
BArcIterator *iter2 = (BArcIterator*)&arc_iter2;
@@ -1013,19 +958,16 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while (bucket1 && bucket2 && bucket1->val < bucket2->val)
- {
+ while (bucket1 && bucket2 && bucket1->val < bucket2->val) {
bucket1 = IT_next(iter1);
}
- while (bucket1 && bucket2 && bucket2->val < bucket1->val)
- {
+ while (bucket1 && bucket2 && bucket2->val < bucket1->val) {
bucket2 = IT_next(iter2);
}
- for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2))
- {
+ for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
bucket2->nv += bucket1->nv; /* add counts */
/* mirror on axis */
@@ -1037,8 +979,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
}
/* second pass, mirror back on previous arcs */
- for (i = count - 1; i > 0; i--)
- {
+ for (i = count - 1; i > 0; i--) {
ReebNode *node1, *node2;
ReebArc *arc1, *arc2;
float tangent[3];
@@ -1061,8 +1002,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
/* Copy buckets
* there shouldn't be any null arcs here, but just to be safe
* */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
+ if (arc1->bcount > 0 && arc2->bcount > 0) {
ReebArcIterator arc_iter1, arc_iter2;
BArcIterator *iter1 = (BArcIterator*)&arc_iter1;
BArcIterator *iter2 = (BArcIterator*)&arc_iter2;
@@ -1075,19 +1015,16 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while (bucket1 && bucket1->val < bucket2->val)
- {
+ while (bucket1 && bucket1->val < bucket2->val) {
bucket1 = IT_next(iter1);
}
- while (bucket2 && bucket2->val < bucket1->val)
- {
+ while (bucket2 && bucket2->val < bucket1->val) {
bucket2 = IT_next(iter2);
}
- for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2))
- {
+ for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
/* copy and mirror back to bucket2 */
bucket2->nv = bucket1->nv;
copy_v3_v3(bucket2->p, bucket1->p);
@@ -1122,8 +1059,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
/* Merge buckets
* there shouldn't be any null arcs here, but just to be safe
* */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
+ if (arc1->bcount > 0 && arc2->bcount > 0) {
ReebArcIterator arc_iter1, arc_iter2;
BArcIterator *iter1 = (BArcIterator*)&arc_iter1;
BArcIterator *iter2 = (BArcIterator*)&arc_iter2;
@@ -1136,19 +1072,16 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while (bucket1 && bucket1->val < bucket2->val)
- {
+ while (bucket1 && bucket1->val < bucket2->val) {
bucket1 = IT_next(iter1);
}
- while (bucket2 && bucket2->val < bucket1->val)
- {
+ while (bucket2 && bucket2->val < bucket1->val) {
bucket2 = IT_next(iter2);
}
- for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2))
- {
+ for ( ; bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
bucket1->nv += bucket2->nv; /* add counts */
/* mirror on axis */
@@ -1175,7 +1108,7 @@ void postprocessGraph(ReebGraph *rg, char mode)
ReebArc *arc;
float fac1 = 0, fac2 = 1, fac3 = 0;
- switch(mode)
+ switch (mode)
{
case SKGEN_AVERAGE:
fac1 = fac2 = fac3 = 1.0f / 3.0f;
@@ -1490,16 +1423,13 @@ static int compareArcs(void *varc1, void *varc2)
float len1 = lengthArc(arc1);
float len2 = lengthArc(arc2);
- if (len1 < len2)
- {
+ if (len1 < len2) {
return -1;
}
- if (len1 > len2)
- {
+ if (len1 > len2) {
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -1508,13 +1438,10 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
{
ReebArc *arc = NULL, *nextArc = NULL;
- if (merging)
- {
+ if (merging) {
/* first pass, merge buckets for arcs that spawned the two nodes into the source arc*/
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc) {
ReebNode *head = srcArc->head;
ReebNode *tail = srcArc->tail;
mergeArcBuckets(srcArc, arc, head->weight, tail->weight);
@@ -1524,47 +1451,38 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
/* second pass, replace removedNode by newNode, remove arcs that are collapsed in a loop */
arc = rg->arcs.first;
- while (arc)
- {
+ while (arc) {
nextArc = arc->next;
- if (arc->head == removedNode || arc->tail == removedNode)
- {
- if (arc->head == removedNode)
- {
+ if (arc->head == removedNode || arc->tail == removedNode) {
+ if (arc->head == removedNode) {
arc->head = newNode;
}
- else
- {
+ else {
arc->tail = newNode;
}
// Remove looped arcs
- if (arc->head == arc->tail)
- {
+ if (arc->head == arc->tail) {
// v1 or v2 was already newNode, since we're removing an arc, decrement degree
NodeDegreeDecrement(rg, newNode);
// If it's srcArc, it'll be removed later, so keep it for now
- if (arc != srcArc)
- {
+ if (arc != srcArc) {
BLI_remlink(&rg->arcs, arc);
REEB_freeArc((BArc*)arc);
}
}
- else
- {
+ else {
/* flip arcs that flipped, can happen on diamond shapes, mostly on null arcs */
- if (arc->head->weight > arc->tail->weight)
- {
+ if (arc->head->weight > arc->tail->weight) {
flipArc(arc);
}
//newNode->degree++; // incrementing degree since we're adding an arc
NodeDegreeIncrement(rg, newNode);
mergeArcFaces(rg, arc, srcArc);
- if (merging)
- {
+ if (merging) {
ReebNode *head = arc->head;
ReebNode *tail = arc->tail;
@@ -1587,12 +1505,10 @@ void filterNullReebGraph(ReebGraph *rg)
ReebArc *arc = NULL, *nextArc = NULL;
arc = rg->arcs.first;
- while (arc)
- {
+ while (arc) {
nextArc = arc->next;
// Only collapse arcs too short to have any embed bucket
- if (arc->bcount == 0)
- {
+ if (arc->bcount == 0) {
ReebNode *newNode = (ReebNode*)arc->head;
ReebNode *removedNode = (ReebNode*)arc->tail;
float blend;
@@ -1623,12 +1539,14 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern
BLI_sortlist(&rg->arcs, compareArcs);
- for (arc = rg->arcs.first; arc; arc = nextArc)
- {
+ for (arc = rg->arcs.first; arc; arc = nextArc) {
nextArc = arc->next;
- // Only collapse non-terminal arcs that are shorter than threshold
- if (threshold_internal > 0 && arc->head->degree > 1 && arc->tail->degree > 1 && (lengthArc(arc) < threshold_internal))
+ /* Only collapse non-terminal arcs that are shorter than threshold */
+ if ((threshold_internal > 0) &&
+ (arc->head->degree > 1) &&
+ (arc->tail->degree > 1) &&
+ (lengthArc(arc) < threshold_internal))
{
ReebNode *newNode = NULL;
ReebNode *removedNode = NULL;
@@ -1650,26 +1568,25 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern
}
// Only collapse terminal arcs that are shorter than threshold
- else if (threshold_external > 0 && (arc->head->degree == 1 || arc->tail->degree == 1) && (lengthArc(arc) < threshold_external))
+ else if ((threshold_external > 0) &&
+ (arc->head->degree == 1 || arc->tail->degree == 1) &&
+ (lengthArc(arc) < threshold_external))
{
ReebNode *terminalNode = NULL;
ReebNode *middleNode = NULL;
ReebNode *removedNode = NULL;
// Assign terminal and middle nodes
- if (arc->head->degree == 1)
- {
+ if (arc->head->degree == 1) {
terminalNode = arc->head;
middleNode = arc->tail;
}
- else
- {
+ else {
terminalNode = arc->tail;
middleNode = arc->head;
}
- if (middleNode->degree == 2 && middleNode != rg->nodes.first)
- {
+ if (middleNode->degree == 2 && middleNode != rg->nodes.first) {
#if 1
// If middle node is a normal node, it will be removed later
// Only if middle node is not the root node
@@ -1685,8 +1602,7 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern
#endif
}
// Otherwise, just plain remove of the arc
- else
- {
+ else {
removedNode = terminalNode;
// removing arc, so we need to decrease the degree of the remaining node
@@ -1713,13 +1629,10 @@ static int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold)
ReebArc *next2;
int filtered = 0;
- for (arc1 = rg->arcs.first; arc1; arc1 = arc1->next)
- {
- for (arc2 = arc1->next; arc2; arc2 = next2)
- {
+ for (arc1 = rg->arcs.first; arc1; arc1 = arc1->next) {
+ for (arc2 = arc1->next; arc2; arc2 = next2) {
next2 = arc2->next;
- if (arc1 != arc2 && arc1->head == arc2->head && arc1->tail == arc2->tail)
- {
+ if (arc1 != arc2 && arc1->head == arc2->head && arc1->tail == arc2->tail) {
mergeArcEdges(rg, arc1, arc2, MERGE_APPEND);
mergeArcFaces(rg, arc1, arc2);
mergeArcBuckets(arc1, arc2, arc1->head->weight, arc1->tail->weight);
@@ -1770,7 +1683,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
int merging = 0;
int total = BLI_ghash_size(arc->faces);
float avg_angle = 0;
- float avg_vec[3] = {0,0,0};
+ float avg_vec[3] = {0, 0, 0};
for (BLI_ghashIterator_init(&ghi, arc->faces);
!BLI_ghashIterator_isDone(&ghi);
@@ -1848,8 +1761,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
if (avg_angle > threshold)
merging = 1;
- if (merging)
- {
+ if (merging) {
ReebNode *terminalNode = NULL;
ReebNode *middleNode = NULL;
ReebNode *newNode = NULL;
@@ -1857,39 +1769,33 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
int merging = 0;
// Assign terminal and middle nodes
- if (arc->head->degree == 1)
- {
+ if (arc->head->degree == 1) {
terminalNode = arc->head;
middleNode = arc->tail;
}
- else
- {
+ else {
terminalNode = arc->tail;
middleNode = arc->head;
}
// If middle node is a normal node, merge to terminal node
- if (middleNode->degree == 2)
- {
+ if (middleNode->degree == 2) {
merging = 1;
newNode = terminalNode;
removedNode = middleNode;
}
// Otherwise, just plain remove of the arc
- else
- {
+ else {
merging = 0;
newNode = middleNode;
removedNode = terminalNode;
}
// Merging arc
- if (merging)
- {
+ if (merging) {
filterArc(rg, newNode, removedNode, arc, 1);
}
- else
- {
+ else {
// removing arc, so we need to decrease the degree of the remaining node
//newNode->degree--;
NodeDegreeDecrement(rg, newNode);
@@ -1920,29 +1826,24 @@ static void filterGraph(ReebGraph *rg, short options, float threshold_internal,
calculateGraphLength(rg);
- if ((options & SKGEN_FILTER_EXTERNAL) == 0)
- {
+ if ((options & SKGEN_FILTER_EXTERNAL) == 0) {
threshold_external = 0;
}
- if ((options & SKGEN_FILTER_INTERNAL) == 0)
- {
+ if ((options & SKGEN_FILTER_INTERNAL) == 0) {
threshold_internal = 0;
}
- if (threshold_internal > 0 || threshold_external > 0)
- {
+ if (threshold_internal > 0 || threshold_external > 0) {
/* filter until there's nothing more to do */
- while (done == 1)
- {
+ while (done == 1) {
done = 0; /* no work done yet */
done = filterInternalExternalReebGraph(rg, threshold_internal, threshold_external);
}
}
- if (options & SKGEN_FILTER_SMART)
- {
+ if (options & SKGEN_FILTER_SMART) {
filterSmartReebGraph(rg, 0.5);
filterCyclesReebGraph(rg, 0.5);
}
@@ -1963,8 +1864,7 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
sortArcs(rg);
- for (i = 0; i < passes; i++)
- {
+ for (i = 0; i < passes; i++) {
postprocessGraph(rg, method);
}
@@ -1973,18 +1873,16 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
/************************************** WEIGHT SPREADING ***********************************************/
-static int compareVerts( const void* a, const void* b )
+static int compareVerts(const void* a, const void* b)
{
EditVert *va = *(EditVert**)a;
EditVert *vb = *(EditVert**)b;
int value = 0;
- if (weightData(va) < weightData(vb))
- {
+ if (weightData(va) < weightData(vb)) {
value = -1;
}
- else if (weightData(va) > weightData(vb))
- {
+ else if (weightData(va) > weightData(vb)) {
value = 1;
}
@@ -2001,26 +1899,21 @@ static void spreadWeight(EditMesh *em)
verts = MEM_callocN(sizeof(EditVert*) * totvert, "verts array");
- for (eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
- {
+ for (eve = em->verts.first, i = 0; eve; eve = eve->next, i++) {
verts[i] = eve;
}
- while (work_needed == 1)
- {
+ while (work_needed == 1) {
work_needed = 0;
qsort(verts, totvert, sizeof(EditVert*), compareVerts);
- for (i = 0; i < totvert; i++)
- {
+ for (i = 0; i < totvert; i++) {
eve = verts[i];
- if (i == 0 || (weightData(eve) - lastWeight) > FLT_EPSILON)
- {
+ if (i == 0 || (weightData(eve) - lastWeight) > FLT_EPSILON) {
lastWeight = weightData(eve);
}
- else
- {
+ else {
work_needed = 1;
weightSetData(eve, lastWeight + FLT_EPSILON * 2);
lastWeight = weightData(eve);
@@ -2044,8 +1937,7 @@ void REEB_exportGraph(ReebGraph *rg, int count)
char filename[128];
FILE *f;
- if (count == -1)
- {
+ if (count == -1) {
strcpy(filename, "test.txt");
}
else {
@@ -2053,15 +1945,13 @@ void REEB_exportGraph(ReebGraph *rg, int count)
}
f = BLI_fopen(filename, "w");
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
int i;
float p[3];
exportNode(f, "v1", arc->head);
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
fprintf(f, "b nv:%i %f %f %f\n", arc->buckets[i].nv, arc->buckets[i].p[0], arc->buckets[i].p[1], arc->buckets[i].p[2]);
}
@@ -2082,12 +1972,10 @@ static void removeZeroNodes(ReebGraph *rg)
{
ReebNode *node, *next_node;
- for (node = rg->nodes.first; node; node = next_node)
- {
+ for (node = rg->nodes.first; node; node = next_node) {
next_node = node->next;
- if (node->degree == 0)
- {
+ if (node->degree == 0) {
BLI_removeNode((BGraph*)rg, (BNode*)node);
}
}
@@ -2098,63 +1986,51 @@ void removeNormalNodes(ReebGraph *rg)
ReebArc *arc, *nextArc;
// Merge degree 2 nodes
- for (arc = rg->arcs.first; arc; arc = nextArc)
- {
+ for (arc = rg->arcs.first; arc; arc = nextArc) {
nextArc = arc->next;
- while (arc->head->degree == 2 || arc->tail->degree == 2)
- {
+ while (arc->head->degree == 2 || arc->tail->degree == 2) {
// merge at v1
- if (arc->head->degree == 2)
- {
+ if (arc->head->degree == 2) {
ReebArc *connectedArc = (ReebArc*)BLI_findConnectedArc((BGraph*)rg, (BArc*)arc, (BNode*)arc->head);
/* If arcs are one after the other */
- if (arc->head == connectedArc->tail)
- {
+ if (arc->head == connectedArc->tail) {
/* remove furthest arc */
- if (arc->tail->weight < connectedArc->head->weight)
- {
+ if (arc->tail->weight < connectedArc->head->weight) {
mergeConnectedArcs(rg, arc, connectedArc);
nextArc = arc->next;
}
- else
- {
+ else {
mergeConnectedArcs(rg, connectedArc, arc);
break; /* arc was removed, move to next */
}
}
/* Otherwise, arcs are side by side */
- else
- {
+ else {
/* Don't do anything, we need to keep the lowest node, even if degree 2 */
break;
}
}
- // merge at v2
- if (arc->tail->degree == 2)
- {
+ /* merge at v2 */
+ if (arc->tail->degree == 2) {
ReebArc *connectedArc = (ReebArc*)BLI_findConnectedArc((BGraph*)rg, (BArc*)arc, (BNode*)arc->tail);
/* If arcs are one after the other */
- if (arc->tail == connectedArc->head)
- {
+ if (arc->tail == connectedArc->head) {
/* remove furthest arc */
- if (arc->head->weight < connectedArc->tail->weight)
- {
+ if (arc->head->weight < connectedArc->tail->weight) {
mergeConnectedArcs(rg, arc, connectedArc);
nextArc = arc->next;
}
- else
- {
+ else {
mergeConnectedArcs(rg, connectedArc, arc);
break; /* arc was removed, move to next */
}
}
/* Otherwise, arcs are side by side */
- else
- {
+ else {
/* Don't do anything, we need to keep the lowest node, even if degree 2 */
break;
}
@@ -2176,13 +2052,11 @@ static ReebArc *nextArcMappedToEdge(ReebArc *arc, ReebEdge *e)
ReebArc *result = NULL;
/* Find the ReebEdge in the edge list */
- for (edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
- { }
+ for (edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next) { }
nextEdge = edge->nextEdge;
- if (nextEdge != NULL)
- {
+ if (nextEdge != NULL) {
result = nextEdge->arc;
}
@@ -2211,51 +2085,42 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
{
ReebEdge *e = NULL;
- if (direction == MERGE_APPEND)
- {
- for (e = aSrc->edges.first; e; e = e->next)
- {
+ if (direction == MERGE_APPEND) {
+ for (e = aSrc->edges.first; e; e = e->next) {
e->arc = aDst; // Edge is stolen by new arc
}
- BLI_movelisttolist(&aDst->edges , &aSrc->edges);
+ BLI_movelisttolist(&aDst->edges, &aSrc->edges);
}
- else
- {
- for (e = aSrc->edges.first; e; e = e->next)
- {
+ else {
+ for (e = aSrc->edges.first; e; e = e->next) {
ReebEdge *newEdge = copyEdge(e);
newEdge->arc = aDst;
BLI_addtail(&aDst->edges, newEdge);
- if (direction == MERGE_LOWER)
- {
+ if (direction == MERGE_LOWER) {
void **p = BLI_edgehash_lookup_p(rg->emap, e->v1->index, e->v2->index);
newEdge->nextEdge = e;
// if edge was the first in the list, point the edit edge to the new reeb edge instead.
- if (*p == e)
- {
+ if (*p == e) {
*p = (void*)newEdge;
}
// otherwise, advance in the list until the predecessor is found then insert it there
- else
- {
+ else {
ReebEdge *previous = (ReebEdge*)*p;
- while (previous->nextEdge != e)
- {
+ while (previous->nextEdge != e) {
previous = previous->nextEdge;
}
previous->nextEdge = newEdge;
}
}
- else
- {
+ else {
newEdge->nextEdge = e->nextEdge;
e->nextEdge = newEdge;
}
@@ -2275,13 +2140,11 @@ int mergeConnectedArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
mergeArcFaces(rg, a0, a1);
// Bring a0 to the combine length of both arcs
- if (a0->tail == a1->head)
- {
+ if (a0->tail == a1->head) {
removedNode = a0->tail;
a0->tail = a1->tail;
}
- else if (a0->head == a1->tail)
- {
+ else if (a0->head == a1->tail) {
removedNode = a0->head;
a0->head = a1->head;
}
@@ -2303,11 +2166,9 @@ int mergeConnectedArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
{
int result = 0;
- // TRIANGLE POINTS DOWN
- if (a0->head->weight == a1->head->weight) // heads are the same
- {
- if (a0->tail->weight == a1->tail->weight) // tails also the same, arcs can be totally merge together
- {
+ /* TRIANGLE POINTS DOWN */
+ if (a0->head->weight == a1->head->weight) { /* heads are the same */
+ if (a0->tail->weight == a1->tail->weight) { /* tails also the same, arcs can be totally merge together */
mergeArcEdges(rg, a0, a1, MERGE_APPEND);
mergeArcFaces(rg, a0, a1);
@@ -2325,8 +2186,7 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
REEB_freeArc((BArc*)a1);
result = 1;
}
- else if (a0->tail->weight > a1->tail->weight) // a1->tail->weight is in the middle
- {
+ else if (a0->tail->weight > a1->tail->weight) { /* a1->tail->weight is in the middle */
mergeArcEdges(rg, a1, a0, MERGE_LOWER);
mergeArcFaces(rg, a1, a0);
@@ -2340,8 +2200,7 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
a0->head = a1->tail;
resizeArcBuckets(a0);
}
- else // a0>n2 is in the middle
- {
+ else { /* a0>n2 is in the middle */
mergeArcEdges(rg, a0, a1, MERGE_LOWER);
mergeArcFaces(rg, a0, a1);
@@ -2356,11 +2215,9 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
resizeArcBuckets(a1);
}
}
- // TRIANGLE POINTS UP
- else if (a0->tail->weight == a1->tail->weight) // tails are the same
- {
- if (a0->head->weight > a1->head->weight) // a0->head->weight is in the middle
- {
+ /* TRIANGLE POINTS UP */
+ else if (a0->tail->weight == a1->tail->weight) { /* tails are the same */
+ if (a0->head->weight > a1->head->weight) { /* a0->head->weight is in the middle */
mergeArcEdges(rg, a0, a1, MERGE_HIGHER);
mergeArcFaces(rg, a0, a1);
@@ -2374,8 +2231,7 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
a1->tail = a0->head;
resizeArcBuckets(a1);
}
- else // a1->head->weight is in the middle
- {
+ else { /* a1->head->weight is in the middle */
mergeArcEdges(rg, a1, a0, MERGE_HIGHER);
mergeArcFaces(rg, a1, a0);
@@ -2390,9 +2246,8 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
resizeArcBuckets(a0);
}
}
- else
- {
- // Need something here (OR NOT)
+ else {
+ /* Need something here (OR NOT) */
}
return result;
@@ -2401,18 +2256,14 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
static void glueByMergeSort(ReebGraph *rg, ReebArc *a0, ReebArc *a1, ReebEdge *e0, ReebEdge *e1)
{
int total = 0;
- while (total == 0 && a0 != a1 && a0 != NULL && a1 != NULL)
- {
+ while (total == 0 && a0 != a1 && a0 != NULL && a1 != NULL) {
total = mergeArcs(rg, a0, a1);
- if (total == 0) // if it wasn't a total merge, go forward
- {
- if (a0->tail->weight < a1->tail->weight)
- {
+ if (total == 0) // if it wasn't a total merge, go forward {
+ if (a0->tail->weight < a1->tail->weight) {
a0 = nextArcMappedToEdge(a0, e0);
}
- else
- {
+ else {
a1 = nextArcMappedToEdge(a1, e1);
}
}
@@ -2437,8 +2288,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
edge = BLI_edgehash_lookup(rg->emap, node1->index, node2->index);
// Only add existing edges that haven't been added yet
- if (edge == NULL)
- {
+ if (edge == NULL) {
ReebArc *arc;
ReebNode *v1, *v2;
float len, offset;
@@ -2451,13 +2301,11 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
arc->symmetry_level = 0;
arc->faces = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createArc gh");
- if (node1->weight <= node2->weight)
- {
+ if (node1->weight <= node2->weight) {
v1 = node1;
v2 = node2;
}
- else
- {
+ else {
v1 = node2;
v2 = node1;
}
@@ -2497,8 +2345,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
addVertToBucket(&(arc->buckets[arc->bcount - 1]), arc->tail->co);
}
#else
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
float co[3];
float f = (arc->buckets[i].val - offset) / len;
@@ -2532,20 +2379,17 @@ static void addTriangleToGraph(ReebGraph *rg, ReebNode * n1, ReebNode * n2, Reeb
/* The rest of the algorithm assumes that e1 is the longest edge */
- if (len1 >= len2 && len1 >= len3)
- {
+ if (len1 >= len2 && len1 >= len3) {
e1 = re1;
e2 = re2;
e3 = re3;
}
- else if (len2 >= len1 && len2 >= len3)
- {
+ else if (len2 >= len1 && len2 >= len3) {
e1 = re2;
e2 = re1;
e3 = re3;
}
- else
- {
+ else {
e1 = re3;
e2 = re2;
e3 = re1;
@@ -2554,8 +2398,7 @@ static void addTriangleToGraph(ReebGraph *rg, ReebNode * n1, ReebNode * n2, Reeb
/* And e2 is the lowest edge
* If e3 is lower than e2, swap them
*/
- if (e3->v1->weight < e2->v1->weight)
- {
+ if (e3->v1->weight < e2->v1->weight) {
ReebEdge *etmp = e2;
e2 = e3;
e3 = etmp;
@@ -2595,10 +2438,8 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
renormalizeWeight(em, (float)rg->resolution);
/* Adding vertice */
- for (index = 0, eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->h == 0)
- {
+ for (index = 0, eve = em->verts.first; eve; eve = eve->next) {
+ if (eve->h == 0) {
addNode(rg, eve);
eve->f2 = 0;
index++;
@@ -2606,10 +2447,8 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
}
/* Adding face, edge per edge */
- for (efa = em->faces.first; efa; efa = efa->next)
- {
- if (efa->h == 0)
- {
+ for (efa = em->faces.first; efa; efa = efa->next) {
+ if (efa->h == 0) {
ReebNode *n1, *n2, *n3;
n1 = nodeData(efa->v1);
@@ -2618,15 +2457,13 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
addTriangleToGraph(rg, n1, n2, n3, efa);
- if (efa->v4)
- {
+ if (efa->v4) {
ReebNode *n4 = nodeData(efa->v4);
addTriangleToGraph(rg, n1, n3, n4, efa);
}
#ifdef DEBUG_REEB
countfaces++;
- if (countfaces % 100 == 0)
- {
+ if (countfaces % 100 == 0) {
printf("\rface %i of %i", countfaces, totfaces);
}
#endif
@@ -2656,8 +2493,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
eve = em->verts.first;
minimum = weightData(eve);
maximum = minimum;
- for (; eve; eve = eve->next)
- {
+ for (; eve; eve = eve->next) {
maximum = MAX2(maximum, weightData(eve));
minimum = MIN2(minimum, weightData(eve));
}
@@ -2665,8 +2501,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
range = maximum - minimum;
/* Normalize weights */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
float weight = (weightData(eve) - minimum) / range * newmax;
weightSetData(eve, weight);
}
@@ -2681,8 +2516,7 @@ int weightFromLoc(EditMesh *em, int axis)
return 0;
/* Copy coordinate in weight */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
weightSetData(eve, eve->co[axis]);
}
@@ -2745,8 +2579,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
int rval;
/* Find local extrema */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
totvert++;
}
@@ -2759,52 +2592,42 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
nlBegin(NL_SYSTEM);
/* Find local extrema */
- for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
- if (eve->h == 0)
- {
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next) {
+ if (eve->h == 0) {
EditEdge *eed;
int maximum = 1;
int minimum = 1;
NextEdgeForVert(indexed_edges, -1); /* Reset next edge */
- for (eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index))
- {
+ for (eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index)) {
EditVert *eve2;
- if (eed->v1 == eve)
- {
+ if (eed->v1 == eve) {
eve2 = eed->v2;
}
- else
- {
+ else {
eve2 = eed->v1;
}
- if (eve2->h == 0)
- {
+ if (eve2->h == 0) {
/* Adjacent vertex is bigger, not a local maximum */
- if (weightData(eve2) > weightData(eve))
- {
+ if (weightData(eve2) > weightData(eve)) {
maximum = 0;
}
/* Adjacent vertex is smaller, not a local minimum */
- else if (weightData(eve2) < weightData(eve))
- {
+ else if (weightData(eve2) < weightData(eve)) {
minimum = 0;
}
}
}
- if (maximum || minimum)
- {
+ if (maximum || minimum) {
float w = weightData(eve);
eve->f1 = 0;
nlSetVariable(0, index, w);
nlLockVariable(index);
}
- else
- {
+ else {
eve->f1 = 1;
}
}
@@ -2813,38 +2636,30 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
nlBegin(NL_MATRIX);
/* Zero edge weight */
- for (eed = em->edges.first; eed; eed = eed->next)
- {
+ for (eed = em->edges.first; eed; eed = eed->next) {
eed->tmp.l = 0;
}
/* Add faces count to the edge weight */
- for (efa = em->faces.first; efa; efa = efa->next)
- {
- if (efa->h == 0)
- {
+ for (efa = em->faces.first; efa; efa = efa->next) {
+ if (efa->h == 0) {
efa->e1->tmp.l++;
efa->e2->tmp.l++;
efa->e3->tmp.l++;
- if (efa->e4)
- {
+ if (efa->e4) {
efa->e4->tmp.l++;
}
}
}
/* Add faces angle to the edge weight */
- for (efa = em->faces.first; efa; efa = efa->next)
- {
- if (efa->h == 0)
- {
- if (efa->v4 == NULL)
- {
+ for (efa = em->faces.first; efa; efa = efa->next) {
+ if (efa->h == 0) {
+ if (efa->v4 == NULL) {
addTriangle(efa->v1, efa->v2, efa->v3, efa->e1->tmp.l, efa->e2->tmp.l, efa->e3->tmp.l);
}
- else
- {
+ else {
addTriangle(efa->v1, efa->v2, efa->v3, efa->e1->tmp.l, efa->e2->tmp.l, 2);
addTriangle(efa->v3, efa->v4, efa->v1, efa->e3->tmp.l, efa->e4->tmp.l, 2);
}
@@ -2857,16 +2672,13 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
success = nlSolveAdvanced(NULL, NL_TRUE);
- if (success)
- {
+ if (success) {
rval = 1;
- for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next) {
weightSetData(eve, nlGetVariable(0, index));
}
}
- else
- {
+ else {
rval = 0;
}
@@ -2881,20 +2693,17 @@ EditEdge * NextEdgeForVert(EdgeIndex *indexed_edges, int index)
static int offset = -1;
/* Reset method, call with NULL mesh pointer */
- if (index == -1)
- {
+ if (index == -1) {
offset = -1;
return NULL;
}
/* first pass, start at the head of the list */
- if (offset == -1)
- {
+ if (offset == -1) {
offset = indexed_edges->offset[index];
}
/* subsequent passes, start on the next edge */
- else
- {
+ else {
offset++;
}
@@ -2916,23 +2725,19 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
BLI_heap_insert(edge_heap, FLT_MAX, NULL);
/* Initialize edge flag */
- for (eed= em->edges.first; eed; eed= eed->next)
- {
+ for (eed= em->edges.first; eed; eed= eed->next) {
eed->f1 = 0;
}
- while (BLI_heap_size(edge_heap) > 0)
- {
+ while (BLI_heap_size(edge_heap) > 0) {
float current_weight;
current_eve->f1 = 1; /* mark vertex as selected */
/* Add all new edges connected to current_eve to the list */
NextEdgeForVert(indexed_edges, -1); // Reset next edge
- for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
- {
- if (eed->f1 == 0)
- {
+ for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve))) {
+ if (eed->f1 == 0) {
BLI_heap_insert(edge_heap, weightData(current_eve) + eed->tmp.fp, eed);
eed->f1 = 1;
}
@@ -2945,16 +2750,13 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
select_eed = BLI_heap_popmin(edge_heap);
} while (select_eed != NULL && select_eed->v1->f1 != 0 && select_eed->v2->f1);
- if (select_eed != NULL)
- {
+ if (select_eed != NULL) {
select_eed->f1 = 2;
- if (select_eed->v1->f1 == 0) /* v1 is the new vertex */
- {
+ if (select_eed->v1->f1 == 0) /* v1 is the new vertex */ {
current_eve = select_eed->v1;
}
- else /* otherwise, it's v2 */
- {
+ else { /* otherwise, it's v2 */
current_eve = select_eed->v2;
}
@@ -2983,10 +2785,8 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
indexed_edges->offset = MEM_callocN(totvert * sizeof(int), "EdgeIndex offset");
- for (eed = em->edges.first; eed; eed = eed->next)
- {
- if (eed->v1->h == 0 && eed->v2->h == 0)
- {
+ for (eed = em->edges.first; eed; eed = eed->next) {
+ if (eed->v1->h == 0 && eed->v2->h == 0) {
tot_indexed += 2;
indexed_edges->offset[indexData(eed->v1)]++;
indexed_edges->offset[indexData(eed->v2)]++;
@@ -2998,10 +2798,8 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
indexed_edges->edges = MEM_callocN(tot_indexed * sizeof(EditEdge*), "EdgeIndex edges");
/* setting vert offsets */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->h == 0)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
+ if (eve->h == 0) {
int d = indexed_edges->offset[indexData(eve)];
indexed_edges->offset[indexData(eve)] = offset;
offset += d + 1;
@@ -3009,24 +2807,18 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
}
/* adding edges in array */
- for (eed = em->edges.first; eed; eed= eed->next)
- {
- if (eed->v1->h == 0 && eed->v2->h == 0)
- {
+ for (eed = em->edges.first; eed; eed= eed->next) {
+ if (eed->v1->h == 0 && eed->v2->h == 0) {
int i;
- for (i = indexed_edges->offset[indexData(eed->v1)]; i < tot_indexed; i++)
- {
- if (indexed_edges->edges[i] == NULL)
- {
+ for (i = indexed_edges->offset[indexData(eed->v1)]; i < tot_indexed; i++) {
+ if (indexed_edges->edges[i] == NULL) {
indexed_edges->edges[i] = eed;
break;
}
}
- for (i = indexed_edges->offset[indexData(eed->v2)]; i < tot_indexed; i++)
- {
- if (indexed_edges->edges[i] == NULL)
- {
+ for (i = indexed_edges->offset[indexData(eed->v2)]; i < tot_indexed; i++) {
+ if (indexed_edges->edges[i] == NULL) {
indexed_edges->edges[i] = eed;
break;
}
@@ -3044,80 +2836,64 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
totvert = BLI_countlist(&em->verts);
- if (em == NULL || totvert == 0)
- {
+ if (em == NULL || totvert == 0) {
return 0;
}
totedge = BLI_countlist(&em->edges);
- if (totedge == 0)
- {
+ if (totedge == 0) {
return 0;
}
/* Initialize vertice flag and find at least one selected vertex */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
eve->f1 = 0;
- if (eve->f & SELECT)
- {
+ if (eve->f & SELECT) {
vCount = 1;
}
}
- if (vCount == 0)
- {
+ if (vCount == 0) {
return 0; /* no selected vert, failure */
}
- else
- {
+ else {
EditEdge *eed;
int allDone = 0;
/* Calculate edge weight */
- for (eed = em->edges.first; eed; eed= eed->next)
- {
- if (eed->v1->h == 0 && eed->v2->h == 0)
- {
+ for (eed = em->edges.first; eed; eed= eed->next) {
+ if (eed->v1->h == 0 && eed->v2->h == 0) {
eed->tmp.fp = len_v3v3(eed->v1->co, eed->v2->co);
}
}
/* Apply dijkstra spf for each selected vert */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->f & SELECT)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
+ if (eve->f & SELECT) {
shortestPathsFromVert(em, eve, indexed_edges);
}
}
/* connect unselected islands */
- while (allDone == 0)
- {
+ while (allDone == 0) {
EditVert *selected_eve = NULL;
float selected_weight = 0;
float min_distance = FLT_MAX;
allDone = 1;
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
/* for every vertex visible that hasn't been processed yet */
- if (eve->h == 0 && eve->f1 != 1)
- {
+ if (eve->h == 0 && eve->f1 != 1) {
EditVert *closest_eve;
/* find the closest processed vertex */
- for (closest_eve = em->verts.first; closest_eve; closest_eve = closest_eve->next)
- {
+ for (closest_eve = em->verts.first; closest_eve; closest_eve = closest_eve->next) {
/* vertex is already processed and distance is smaller than current minimum */
- if (closest_eve->f1 == 1)
- {
+ if (closest_eve->f1 == 1) {
float distance = len_v3v3(closest_eve->co, eve->co);
- if (distance < min_distance)
- {
+ if (distance < min_distance) {
min_distance = distance;
selected_eve = eve;
selected_weight = weightData(closest_eve);
@@ -3127,8 +2903,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- if (selected_eve)
- {
+ if (selected_eve) {
allDone = 0;
weightSetData(selected_eve, selected_weight + min_distance);
@@ -3137,10 +2912,8 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- for (eve = em->verts.first; eve && vCount == 0; eve = eve->next)
- {
- if (eve->f1 == 0)
- {
+ for (eve = em->verts.first; eve && vCount == 0; eve = eve->next) {
+ if (eve->f1 == 0) {
printf("vertex not reached\n");
break;
}
@@ -3173,13 +2946,11 @@ static void initIteratorFct(ReebArcIterator *iter)
static void setIteratorValues(ReebArcIterator *iter, EmbedBucket *bucket)
{
- if (bucket)
- {
+ if (bucket) {
iter->p = bucket->p;
iter->no = bucket->no;
}
- else
- {
+ else {
iter->p = NULL;
iter->no = NULL;
}
@@ -3193,14 +2964,12 @@ void initArcIterator(BArcIterator *arg, ReebArc *arc, ReebNode *head)
initIteratorFct(iter);
iter->arc = arc;
- if (head == arc->head)
- {
+ if (head == arc->head) {
iter->start = 0;
iter->end = arc->bcount - 1;
iter->stride = 1;
}
- else
- {
+ else {
iter->start = arc->bcount - 1;
iter->end = 0;
iter->stride = -1;
@@ -3218,14 +2987,12 @@ void initArcIteratorStart(BArcIterator *arg, struct ReebArc *arc, struct ReebNod
initIteratorFct(iter);
iter->arc = arc;
- if (head == arc->head)
- {
+ if (head == arc->head) {
iter->start = start;
iter->end = arc->bcount - 1;
iter->stride = 1;
}
- else
- {
+ else {
iter->start = arc->bcount - 1 - start;
iter->end = 0;
iter->stride = -1;
@@ -3235,8 +3002,7 @@ void initArcIteratorStart(BArcIterator *arg, struct ReebArc *arc, struct ReebNod
iter->length = arc->bcount - start;
- if (start >= arc->bcount)
- {
+ if (start >= arc->bcount) {
iter->start = iter->end; /* stop iterator since it's past its end */
}
}
@@ -3251,12 +3017,10 @@ void initArcIterator2(BArcIterator *arg, ReebArc *arc, int start, int end)
iter->start = start;
iter->end = end;
- if (end > start)
- {
+ if (end > start) {
iter->stride = 1;
}
- else
- {
+ else {
iter->stride = -1;
}
@@ -3270,12 +3034,10 @@ static void* headNode(void *arg)
ReebArcIterator *iter = (ReebArcIterator*)arg;
ReebNode *node;
- if (iter->start < iter->end)
- {
+ if (iter->start < iter->end) {
node = iter->arc->head;
}
- else
- {
+ else {
node = iter->arc->tail;
}
@@ -3291,12 +3053,10 @@ static void* tailNode(void *arg)
ReebArcIterator *iter = (ReebArcIterator*)arg;
ReebNode *node;
- if (iter->start < iter->end)
- {
+ if (iter->start < iter->end) {
node = iter->arc->tail;
}
- else
- {
+ else {
node = iter->arc->head;
}
@@ -3314,8 +3074,7 @@ static void* nextBucket(void *arg)
iter->index++;
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
}
@@ -3331,8 +3090,7 @@ static void* nextNBucket(void *arg, int n)
iter->index += n;
/* check if passed end */
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
}
@@ -3347,8 +3105,7 @@ static void* peekBucket(void *arg, int n)
int index = iter->index + n;
/* check if passed end */
- if (index < iter->length)
- {
+ if (index < iter->length) {
result = &(iter->arc->buckets[iter->start + (iter->stride * index)]);
}
@@ -3361,8 +3118,7 @@ static void* previousBucket(void *arg)
ReebArcIterator *iter = (ReebArcIterator*)arg;
EmbedBucket *result = NULL;
- if (iter->index > 0)
- {
+ if (iter->index > 0) {
iter->index--;
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
}
@@ -3375,12 +3131,10 @@ static int iteratorStopped(void *arg)
{
ReebArcIterator *iter = (ReebArcIterator*)arg;
- if (iter->index >= iter->length)
- {
+ if (iter->index >= iter->length) {
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -3716,18 +3470,18 @@ void REEB_draw()
glColor3f(0, 1, 0);
glRasterPos3fv(vec);
- BMF_DrawString( G.fonts, text);
+ BMF_DrawString(G.fonts, text);
}
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX)
{
sprintf(text, " %i", arc->head->index);
glRasterPos3fv(arc->head->p);
- BMF_DrawString( G.fonts, text);
+ BMF_DrawString(G.fonts, text);
sprintf(text, " %i", arc->tail->index);
glRasterPos3fv(arc->tail->p);
- BMF_DrawString( G.fonts, text);
+ BMF_DrawString(G.fonts, text);
}
}
glEnable(GL_DEPTH_TEST);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index c19041b817e..15e2ad77fa9 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -108,7 +108,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu
static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus);
/* still need to eradicate a few :( */
-#define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name)
+#define callocstructN(x, y, name) (x*)MEM_callocN((y)* sizeof(x), name)
static float nurbcircle[8][2]= {
{0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0},
@@ -132,7 +132,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
if (nu==NULL)
cu->actnu = -1;
else {
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
cu->actnu = BLI_findindex(nurbs, nu);
}
}
@@ -140,7 +140,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
static Nurb *get_actNurb(Object *obedit)
{
Curve *cu= obedit->data;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
return BLI_findlink(nurbs, cu->actnu);
}
@@ -736,7 +736,7 @@ static void calc_keyHandles(ListBase *nurb, float *key)
if (nextp) key_to_bezt(nextfp, nextp, &next);
if (prevp) key_to_bezt(prevfp, prevp, &prev);
- calchandleNurb(&cur, prevp ? &prev : NULL, nextp ? &next : NULL, 0);
+ BKE_nurb_handle_calc(&cur, prevp ? &prev : NULL, nextp ? &next : NULL, 0);
bezt_to_key(&cur, fp);
prevp= bezt;
@@ -782,7 +782,7 @@ static void calc_shapeKeys(Object *obedit)
BezTriple *bezt, *oldbezt;
BPoint *bp, *oldbp;
Nurb *nu;
- int totvert= count_curveverts(&editnurb->nurbs);
+ int totvert= BKE_nurbList_verts_count(&editnurb->nurbs);
float (*ofs)[3] = NULL;
float *oldkey, *newkey, *ofp;
@@ -1207,11 +1207,11 @@ void load_editNurb(Object *obedit)
ListBase newnurb= {NULL, NULL}, oldnurb= cu->nurb;
for (nu= editnurb->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
BLI_addtail(&newnurb, newnu);
if (nu->type == CU_NURBS) {
- clamp_nurb_order_u(nu);
+ BKE_nurb_order_clamp_u(nu);
}
}
@@ -1220,7 +1220,7 @@ void load_editNurb(Object *obedit)
calc_shapeKeys(obedit);
ED_curve_updateAnimPaths(obedit->data);
- freeNurblist(&oldnurb);
+ BKE_nurbList_free(&oldnurb);
}
set_actNurb(obedit, NULL);
@@ -1247,8 +1247,8 @@ void make_editNurb(Object *obedit)
}
if (editnurb) {
- freeNurblist(&editnurb->nurbs);
- free_curve_editNurb_keyIndex(editnurb);
+ BKE_nurbList_free(&editnurb->nurbs);
+ BKE_curve_editNurb_keyIndex_free(editnurb);
editnurb->keyindex= NULL;
}
else {
@@ -1260,8 +1260,8 @@ void make_editNurb(Object *obedit)
cu->lastsel= NULL; /* for select row */
while (nu) {
- newnu= duplicateNurb(nu);
- test2DNurb(newnu); // after join, or any other creation of curve
+ newnu= BKE_nurb_duplicate(nu);
+ BKE_nurb_test2D(newnu); // after join, or any other creation of curve
BLI_addtail(&editnurb->nurbs, newnu);
if (nu_act == NULL && isNurbsel(nu)) {
@@ -1285,7 +1285,7 @@ void free_editNurb(Object *obedit)
{
Curve *cu= obedit->data;
- free_curve_editNurb(cu);
+ BKE_curve_editNurb_free(cu);
}
void CU_deselect_all(Object *obedit)
@@ -1377,15 +1377,15 @@ static int separate_exec(bContext *C, wmOperator *op)
ED_base_object_select(newbase, BA_DESELECT);
newob= newbase->object;
- newcu= newob->data= copy_curve(oldcu);
+ newcu= newob->data= BKE_curve_copy(oldcu);
newcu->editnurb= NULL;
oldcu->id.us--; /* because new curve is a copy: reduce user count */
/* 2. put new object in editmode and clear it */
make_editNurb(newob);
newedit= newcu->editnurb;
- freeNurblist(&newedit->nurbs);
- free_curve_editNurb_keyIndex(newedit);
+ BKE_nurbList_free(&newedit->nurbs);
+ BKE_curve_editNurb_keyIndex_free(newedit);
/* 3. move over parts from old object */
for (nu= oldedit->nurbs.first; nu; nu=nu1) {
@@ -1547,7 +1547,7 @@ static void translateflagNurb(ListBase *editnurb, short flag, const float vec[3]
}
}
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
}
}
@@ -1602,7 +1602,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
if (a==0) {
BLI_remlink(editnurb, nu);
keyIndex_delNurb(cu->editnurb, nu);
- freeNurb(nu); nu=NULL;
+ BKE_nurb_free(nu); nu=NULL;
}
else {
/* is nurb in U direction selected */
@@ -1640,9 +1640,9 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
nu->pntsv= newv;
MEM_freeN(nu->bp);
nu->bp= newbp;
- clamp_nurb_order_v(nu);
+ BKE_nurb_order_clamp_v(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
else {
/* is the nurb in V direction selected */
@@ -1684,15 +1684,15 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
nu->pntsu= nu->pntsv;
nu->pntsv= 1;
SWAP(short, nu->orderu, nu->orderv);
- clamp_nurb_order_u(nu);
+ BKE_nurb_order_clamp_u(nu);
if (nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= NULL;
}
else {
nu->pntsu= newu;
- clamp_nurb_order_u(nu);
+ BKE_nurb_order_clamp_u(nu);
}
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
}
@@ -1743,7 +1743,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
nu->pntsv= 2;
nu->orderv= 2;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
}
else {
@@ -1786,7 +1786,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
nu->pntsv++;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
else if (v==0 || v== nu->pntsu-1) { /* column in v-direction selected */
ok= 1;
@@ -1813,7 +1813,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
nu->pntsu++;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
}
@@ -1911,7 +1911,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
/* knots */
newnu->knotsu= NULL;
- nurbs_knot_calc_u(newnu);
+ BKE_nurb_knot_calc_u(newnu);
}
bp++;
}
@@ -1956,8 +1956,8 @@ static void adduplicateflagNurb(Object *obedit, short flag)
newnu->pntsv= newv;
newnu->bp =
(BPoint*)MEM_mallocN(newu * newv * sizeof(BPoint), "adduplicateN6");
- clamp_nurb_order_u(newnu);
- clamp_nurb_order_v(newnu);
+ BKE_nurb_order_clamp_u(newnu);
+ BKE_nurb_order_clamp_v(newnu);
newnu->knotsu= newnu->knotsv= NULL;
@@ -1972,20 +1972,20 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
}
}
- if (check_valid_nurb_u(newnu)) {
+ if (BKE_nurb_check_valid_u(newnu)) {
if (nu->pntsu==newnu->pntsu && nu->knotsu) {
- newnu->knotsu= MEM_dupallocN( nu->knotsu );
+ newnu->knotsu= MEM_dupallocN(nu->knotsu);
}
else {
- nurbs_knot_calc_u(newnu);
+ BKE_nurb_knot_calc_u(newnu);
}
}
- if (check_valid_nurb_v(newnu)) {
+ if (BKE_nurb_check_valid_v(newnu)) {
if (nu->pntsv==newnu->pntsv && nu->knotsv) {
- newnu->knotsv= MEM_dupallocN( nu->knotsv );
+ newnu->knotsv= MEM_dupallocN(nu->knotsv);
}
else {
- nurbs_knot_calc_v(newnu);
+ BKE_nurb_knot_calc_v(newnu);
}
}
}
@@ -2010,7 +2010,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
for (nu= editnurb->nurbs.first; nu; nu= nu->next)
if (isNurbsel(nu)) {
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
@@ -2157,7 +2157,7 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
for (nu= editnurb->first; nu; nu= nu->next) {
if (nu->bezt) {
change = 0;
- beztOrig = MEM_dupallocN( nu->bezt );
+ beztOrig = MEM_dupallocN(nu->bezt);
for (bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
if (bezt->f2 & SELECT) {
for (i=0; i<3; i++) {
@@ -2174,10 +2174,10 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
}
MEM_freeN(beztOrig);
if (change)
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if (nu->bp) {
- bpOrig = MEM_dupallocN( nu->bp );
+ bpOrig = MEM_dupallocN(nu->bp);
/* Same as above, keep these the same! */
for (bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
if (bp->f1 & SELECT) {
@@ -2893,7 +2893,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->bezt= beztnew;
nu->pntsu+= amount;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
} /* End of 'if (nu->type == CU_BEZIER)' */
else if (nu->pntsv==1) {
@@ -2965,7 +2965,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->pntsu+= amount;
if (nu->type & CU_NURBS) {
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
} /* End of 'else if (nu->pntsv==1)' */
@@ -3039,7 +3039,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
/* total count of nodes after subdivision */
int tot= ((number_cuts+1)*nu->pntsu-number_cuts)*((number_cuts+1)*nu->pntsv-number_cuts);
- bpn=bpnew= MEM_mallocN( tot*sizeof(BPoint), "subdivideNurb4");
+ bpn=bpnew= MEM_mallocN(tot*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
/* first subdivide rows */
for (a=0; a<nu->pntsv; a++) {
@@ -3086,8 +3086,8 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->bp= bpnew;
nu->pntsu= (number_cuts+1)*nu->pntsu-number_cuts;
nu->pntsv= (number_cuts+1)*nu->pntsv-number_cuts;
- nurbs_knot_calc_u(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_u(nu);
+ BKE_nurb_knot_calc_v(nu);
} /* End of 'if (sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */
else {
/* subdivide in v direction? */
@@ -3097,7 +3097,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
}
if (sel) { /* V ! */
- bpn=bpnew= MEM_mallocN( (sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
+ bpn=bpnew= MEM_mallocN((sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
for (a=0; a<nu->pntsv; a++) {
for (b=0; b<nu->pntsu; b++) {
@@ -3132,7 +3132,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
MEM_freeN(nu->bp);
nu->bp= bpnew;
nu->pntsv+= sel;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
else {
/* or in u direction? */
@@ -3144,7 +3144,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
if (sel) { /* U ! */
/* Inserting U points is sort of 'default' Flat curves only get */
/* U points inserted in them. */
- bpn=bpnew= MEM_mallocN( (sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
+ bpn=bpnew= MEM_mallocN((sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
for (a=0; a<nu->pntsv; a++) {
for (b=0; b<nu->pntsu; b++) {
@@ -3173,7 +3173,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
MEM_freeN(nu->bp);
nu->bp= bpnew;
nu->pntsu+= sel;
- nurbs_knot_calc_u(nu); /* shift knots forward */
+ BKE_nurb_knot_calc_u(nu); /* shift knots forward */
}
}
}
@@ -3373,13 +3373,13 @@ static int convertspline(short type, Nurb *nu)
nu->bp= NULL;
nu->pntsu= nr;
nu->type = CU_BEZIER;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if (type==CU_NURBS) {
nu->type = CU_NURBS;
nu->orderu= 4;
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
while (a--) {
@@ -3436,7 +3436,7 @@ static int convertspline(short type, Nurb *nu)
if (type== CU_NURBS) {
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nu->flagu |= CU_NURB_BEZIER;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
}
@@ -3559,7 +3559,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= object_editcurve_get(obedit);
- sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type"));
+ BKE_nurbList_handles_set(editnurb, RNA_enum_get(op->ptr, "type"));
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, 0);
@@ -3651,7 +3651,7 @@ static void rotate_direction_nurb(Nurb *nu)
SWAP(short, nu->flagu, nu->flagv);
SWAP(float *, nu->knotsu, nu->knotsv);
- switchdirection_knots(nu->knotsv, KNOTSV(nu) );
+ switchdirection_knots(nu->knotsv, KNOTSV(nu));
temp= MEM_dupallocN(nu->bp);
bp1= nu->bp;
@@ -3719,7 +3719,7 @@ static void make_selection_list_nurb(ListBase *editnurb)
/* just add the first one */
nus= nbase.first;
BLI_remlink(&nbase, nus);
- BLI_addtail( &nsortbase, nus);
+ BLI_addtail(&nsortbase, nus);
/* now add, either at head or tail, the closest one */
while (nbase.first) {
@@ -3865,15 +3865,15 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
if (nu1->type == CU_NURBS) {
/* merge knots */
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
/* make knots, for merged curved for example */
- nurbs_knot_calc_v(nu1);
+ BKE_nurb_knot_calc_v(nu1);
}
MEM_freeN(temp);
BLI_remlink(editnurb, nu2);
- freeNurb(nu2);
+ BKE_nurb_free(nu2);
}
static int merge_nurb(bContext *C, wmOperator *op)
@@ -3976,7 +3976,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
else {
if ( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
nu1= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
}
@@ -3984,7 +3984,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
else if (nu2==NULL) {
if ( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
nu2= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
@@ -4003,7 +4003,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
bp= bp+(nu->pntsu-1);
if ( bp->f1 & SELECT ) {
nu1= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
}
@@ -4011,7 +4011,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
else if (nu2==NULL) {
if ( bp->f1 & SELECT ) {
nu2= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
@@ -4038,8 +4038,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu1->bezt= bezt;
nu1->pntsu+= nu2->pntsu;
BLI_remlink(nubase, nu2);
- freeNurb(nu2); nu2= NULL;
- calchandlesNurb(nu1);
+ BKE_nurb_free(nu2); nu2= NULL;
+ BKE_nurb_handles_calc(nu1);
}
else {
bp =
@@ -4057,7 +4057,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* now join the knots */
if (nu1->type == CU_NURBS) {
if (nu1->knotsu==NULL) {
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
}
else {
fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3");
@@ -4076,7 +4076,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
}
}
- freeNurb(nu2); nu2= NULL;
+ BKE_nurb_free(nu2); nu2= NULL;
}
set_actNurb(obedit, nu1); /* for selected */
@@ -4088,12 +4088,12 @@ static int make_segment_exec(bContext *C, wmOperator *op)
if (nu1->type == CU_BEZIER && BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt) &&
BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt+(nu1->pntsu-1))) {
nu1->flagu|= CU_NURB_CYCLIC;
- calchandlesNurb(nu1);
+ BKE_nurb_handles_calc(nu1);
ok= 1;
}
else if (nu1->type == CU_NURBS && nu1->bp->f1&SELECT && (nu1->bp+(nu1->pntsu-1))->f1&SELECT) {
nu1->flagu|= CU_NURB_CYCLIC;
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
ok= 1;
}
}
@@ -4224,10 +4224,10 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
Curve *cu= (Curve*)obedit->data;
ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
- float si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3];
+ float si, phi, n[3], q[4], cmat[3][3], tmat[3][3], imat[3][3];
float bmat[3][3], rotmat[3][3], scalemat1[3][3], scalemat2[3][3];
float persmat[3][3], persinv[3][3];
- short a,ok, changed= 0;
+ short a, ok, changed= 0;
copy_m3_m4(persmat, viewmat);
invert_m3_m3(persinv, persmat);
@@ -4244,7 +4244,7 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
q[1]= n[0]*si;
q[2]= n[1]*si;
q[3]= n[2]*si;
- quat_to_mat3( cmat,q);
+ quat_to_mat3(cmat, q);
mul_m3_m3m3(tmat, cmat, bmat);
mul_m3_m3m3(rotmat, imat, tmat);
@@ -4252,19 +4252,19 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
scalemat1[0][0]= M_SQRT2;
scalemat1[1][1]= M_SQRT2;
- mul_m3_m3m3(tmat,persmat,bmat);
- mul_m3_m3m3(cmat,scalemat1,tmat);
- mul_m3_m3m3(tmat,persinv,cmat);
- mul_m3_m3m3(scalemat1,imat,tmat);
+ mul_m3_m3m3(tmat, persmat, bmat);
+ mul_m3_m3m3(cmat, scalemat1, tmat);
+ mul_m3_m3m3(tmat, persinv, cmat);
+ mul_m3_m3m3(scalemat1, imat, tmat);
unit_m3(scalemat2);
- scalemat2[0][0]/= (float)M_SQRT2;
- scalemat2[1][1]/= (float)M_SQRT2;
+ scalemat2[0][0] /= (float)M_SQRT2;
+ scalemat2[1][1] /= (float)M_SQRT2;
- mul_m3_m3m3(tmat,persmat,bmat);
- mul_m3_m3m3(cmat,scalemat2,tmat);
- mul_m3_m3m3(tmat,persinv,cmat);
- mul_m3_m3m3(scalemat2,imat,tmat);
+ mul_m3_m3m3(tmat, persmat, bmat);
+ mul_m3_m3m3(cmat, scalemat2, tmat);
+ mul_m3_m3m3(tmat, persinv, cmat);
+ mul_m3_m3m3(scalemat2, imat, tmat);
ok= 1;
@@ -4293,7 +4293,7 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
if (isNurbsel(nu)) {
nu->orderv= 4;
nu->flagv |= CU_NURB_CYCLIC;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
}
}
@@ -4446,7 +4446,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
newbp->vec[3]= 1.0;
newnu->knotsu= newnu->knotsv= NULL;
- nurbs_knot_calc_u(newnu);
+ BKE_nurb_knot_calc_u(newnu);
ok= 1;
nu= newnu;
@@ -4533,23 +4533,23 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
else {
mul_v3_m4v3(newbezt->vec[1], imat, location);
- sub_v3_v3v3(temp, newbezt->vec[1],temp);
+ sub_v3_v3v3(temp, newbezt->vec[1], temp);
if (bezt_recalc[1]) {
const char h1 = bezt_recalc[1]->h1, h2 = bezt_recalc[1]->h2;
bezt_recalc[1]->h1 = bezt_recalc[1]->h2 = HD_AUTO;
- calchandleNurb(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
+ BKE_nurb_handle_calc(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
bezt_recalc[1]->h1 = h1;
bezt_recalc[1]->h2 = h2;
}
else {
- add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp);
- add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp);
+ add_v3_v3v3(newbezt->vec[0], bezt->vec[0], temp);
+ add_v3_v3v3(newbezt->vec[2], bezt->vec[2], temp);
}
- if (newnu) calchandlesNurb(newnu);
- else calchandlesNurb(nu);
+ if (newnu) BKE_nurb_handles_calc(newnu);
+ else BKE_nurb_handles_calc(nu);
}
}
}
@@ -4617,14 +4617,14 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
if (!newnu) {
nu->pntsu++;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
- else nurbs_knot_calc_u(newnu);
+ else BKE_nurb_knot_calc_u(newnu);
}
}
if (ok) {
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
@@ -4783,7 +4783,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
}
bezt++;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if (nu->pntsv==1 && nu->type == CU_NURBS) {
if (nu->knotsu) { /* if check_valid_nurb_u fails the knotsu can be NULL */
@@ -4792,7 +4792,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
while (a--) {
if ( bp->f1 & SELECT ) {
nu->flagu ^= CU_NURB_CYCLIC;
- nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
break;
}
bp++;
@@ -4807,11 +4807,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
if ( bp->f1 & SELECT) {
if (direction==0 && nu->pntsu>1) {
nu->flagu ^= CU_NURB_CYCLIC;
- nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
}
if (direction==1 && nu->pntsv>1) {
nu->flagv ^= CU_NURB_CYCLIC;
- nurbs_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
}
break;
}
@@ -5398,7 +5398,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
BPoint *bp;
int a;
- BLI_srand( BLI_rand() ); /* random seed */
+ BLI_srand(BLI_rand()); /* random seed */
for (nu= editnurb->first; nu; nu= nu->next) {
if (nu->type == CU_BEZIER) {
@@ -5472,7 +5472,7 @@ static int point_on_nurb(Nurb *nu, void *point)
static Nurb *get_lastsel_nurb(Curve *cu)
{
- ListBase *nubase= curve_editnurbs(cu);
+ ListBase *nubase= BKE_curve_editNurbs_get(cu);
Nurb *nu= nubase->first;
if (!cu->lastsel)
@@ -5638,7 +5638,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
else {
keyIndex_delNurbList(editnurb, nubase);
- freeNurblist(nubase);
+ BKE_nurbList_free(nubase);
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
@@ -5672,7 +5672,7 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
- freeNurb(nu); nu= NULL;
+ BKE_nurb_free(nu); nu= NULL;
}
}
}
@@ -5692,7 +5692,7 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
- freeNurb(nu); nu= NULL;
+ BKE_nurb_free(nu); nu= NULL;
}
}
}
@@ -5730,11 +5730,11 @@ static int delete_exec(bContext *C, wmOperator *op)
if (type) {
bezt1 =
(BezTriple*)MEM_mallocN((nu->pntsu) * sizeof(BezTriple), "delNurb");
- memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple) );
+ memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple));
keyIndex_updateBezt(editnurb, nu->bezt, bezt1, nu->pntsu);
MEM_freeN(nu->bezt);
nu->bezt= bezt1;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
}
else if (nu->pntsv==1) {
@@ -5757,7 +5757,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
if (type) {
bp1 = (BPoint*)MEM_mallocN(nu->pntsu * sizeof(BPoint), "delNurb2");
- memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint) );
+ memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint));
keyIndex_updateBP(editnurb, nu->bp, bp1, nu->pntsu);
MEM_freeN(nu->bp);
nu->bp= bp1;
@@ -5770,8 +5770,8 @@ static int delete_exec(bContext *C, wmOperator *op)
}
#endif
}
- clamp_nurb_order_u(nu);
- nurbs_knot_calc_u(nu);
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
nu= next;
}
@@ -5797,7 +5797,7 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt2= bezt+(nu->pntsu-1);
if ( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
nu->flagu &= ~CU_NURB_CYCLIC;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, 0);
}
@@ -5850,7 +5850,7 @@ static int delete_exec(bContext *C, wmOperator *op)
cu->actnu= -1;
BLI_remlink(nubase, nu);
- freeNurb(nu); nu = NULL;
+ BKE_nurb_free(nu); nu = NULL;
}
else if (nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bezt =
@@ -5862,7 +5862,7 @@ static int delete_exec(bContext *C, wmOperator *op)
nu1->flagu &= ~CU_NURB_CYCLIC;
MEM_freeN(bezt);
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else { /* add new curve */
@@ -5886,8 +5886,8 @@ static int delete_exec(bContext *C, wmOperator *op)
nu->pntsu= cut+1;
- calchandlesNurb(nu);
- calchandlesNurb(nu1);
+ BKE_nurb_handles_calc(nu);
+ BKE_nurb_handles_calc(nu1);
}
}
else if (bp1) {
@@ -5896,7 +5896,7 @@ static int delete_exec(bContext *C, wmOperator *op)
cu->actnu= -1;
BLI_remlink(nubase, nu);
- freeNurb(nu); nu= NULL;
+ BKE_nurb_free(nu); nu= NULL;
}
else if (nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bp =
@@ -5926,11 +5926,11 @@ static int delete_exec(bContext *C, wmOperator *op)
nu1->knotsu= NULL;
nu->pntsu= cut+1;
- clamp_nurb_order_u(nu);
- nurbs_knot_calc_u(nu);
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
- clamp_nurb_order_u(nu1);
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_order_clamp_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
}
}
}
@@ -5938,7 +5938,7 @@ static int delete_exec(bContext *C, wmOperator *op)
else if (type==2) {
cu->actnu= -1;
keyIndex_delNurbList(editnurb, nubase);
- freeNurblist(nubase);
+ BKE_nurbList_free(nubase);
}
if (ED_curve_updateAnimPaths(obedit->data))
@@ -6071,7 +6071,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
/* trasnform all selected curves inverse in obact */
invert_m4_m4(imat, ob->obmat);
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
if (base->object->type==ob->type) {
if (base->object != ob) {
@@ -6083,7 +6083,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
nu= cu->nurb.first;
while (nu) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
if (ob->totcol) { /* TODO, merge material lists */
CLAMP(newnu->mat_nr, 0, ob->totcol-1);
}
@@ -6098,7 +6098,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
mul_m4_v3(cmat, bezt->vec[2]);
bezt++;
}
- calchandlesNurb(newnu);
+ BKE_nurb_handles_calc(newnu);
}
if ( (bp= newnu->bp) ) {
a= newnu->pntsu*nu->pntsv;
@@ -6207,7 +6207,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->resolv= cu->resolv;
}
- switch(stype) {
+ switch (stype) {
case CU_PRIM_CURVE: /* curve */
nu->resolu= cu->resolu;
if (cutype==CU_BEZIER) {
@@ -6240,7 +6240,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->vec[2][1] = 0;
for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else {
@@ -6268,11 +6268,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 1.5f*grid;
bp= nu->bp;
- for (a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec);
+ for (a=0;a<4;a++, bp++) mul_m4_v3(mat, bp->vec);
if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
@@ -6302,11 +6302,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 2.0f*grid;
bp= nu->bp;
- for (a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec);
+ for (a=0;a<5;a++, bp++) mul_m4_v3(mat, bp->vec);
if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
break;
@@ -6323,31 +6323,31 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= -grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= -grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if ( cutype==CU_NURBS ) { /* nurb */
nu->pntsu= 8;
@@ -6369,13 +6369,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
if (a & 1) bp->vec[3]= 0.25*M_SQRT2;
else bp->vec[3]= 1.0;
- mul_m4_v3(mat,bp->vec);
+ mul_m4_v3(mat, bp->vec);
bp->radius = bp->weight = 1.0;
bp++;
}
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
break;
case CU_PRIM_PATCH: /* 4x4 patch */
@@ -6401,14 +6401,14 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if (a==1 || a==2) if (b==1 || b==2) {
bp->vec[2]+= grid;
}
- mul_m4_v3(mat,bp->vec);
+ mul_m4_v3(mat, bp->vec);
bp->vec[3]= 1.0;
bp++;
}
}
- nurbs_knot_calc_u(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_u(nu);
+ BKE_nurb_knot_calc_v(nu);
}
break;
case CU_PRIM_TUBE: /* Cylinder */
@@ -6465,11 +6465,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[2]+= nurbcircle[a][1]*grid;
if (a & 1) bp->vec[3]= 0.5*M_SQRT2;
else bp->vec[3]= 1.0;
- mul_m4_v3(mat,bp->vec);
+ mul_m4_v3(mat, bp->vec);
bp++;
}
nu->flagu= CU_NURB_BEZIER;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
BLI_addtail(editnurb, nu); /* temporal for spin */
@@ -6477,7 +6477,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(viewmat, obedit, zvec, mat[3]);
else spin_nurb(umat, obedit, tmp_vec, mat[3]);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
@@ -6529,7 +6529,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if (nu) { /* should always be set */
nu->flag |= CU_SMOOTH;
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
}
return nu;
@@ -6947,13 +6947,13 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
Curve *cu= cu_v;
UndoCurve *undoCurve= ucu;
ListBase *undobase= &undoCurve->nubase;
- ListBase *editbase= curve_editnurbs(cu);
+ ListBase *editbase= BKE_curve_editNurbs_get(cu);
Nurb *nu, *newnu;
EditNurb *editnurb= cu->editnurb;
void *lastsel= NULL;
AnimData *ad= BKE_animdata_from_id(&cu->id);
- freeNurblist(editbase);
+ BKE_nurbList_free(editbase);
if (undoCurve->undoIndex) {
BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)MEM_freeN);
@@ -6972,7 +6972,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
/* copy */
for (nu= undobase->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
if (lastsel == NULL) {
lastsel= undo_check_lastsel(undoCurve->lastsel, nu, newnu);
@@ -6993,7 +6993,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
{
Curve *cu= cu_v;
- ListBase *nubase= curve_editnurbs(cu);
+ ListBase *nubase= BKE_curve_editNurbs_get(cu);
UndoCurve *undoCurve;
EditNurb *editnurb= cu->editnurb, tmpEditnurb;
Nurb *nu, *newnu;
@@ -7016,7 +7016,7 @@ static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
/* copy */
for (nu= nubase->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
if (lastsel == NULL) {
lastsel= undo_check_lastsel(cu->lastsel, nu, newnu);
@@ -7039,7 +7039,7 @@ static void free_undoCurve(void *ucv)
{
UndoCurve *undoCurve= ucv;
- freeNurblist(&undoCurve->nubase);
+ BKE_nurbList_free(&undoCurve->nubase);
if (undoCurve->undoIndex)
BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)MEM_freeN);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 1f1d1495276..cca5dd7a37b 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -520,13 +520,17 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
}
/********************** utilities ***************************/
-
static short next_word(Curve *cu)
{
short s;
- for (s=cu->pos; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
- (cu->str[s]!=1) && (cu->str[s]!='\r'); s++);
- if (cu->str[s]) return(s+1); else return(s);
+ for (s=cu->pos; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
+ (cu->str[s] != 1) && (cu->str[s] != '\r'));
+ s++)
+ {
+ /* pass */
+ }
+
+ return cu->str[s] ? (s + 1) : s;
}
static short prev_word(Curve *cu)
@@ -534,9 +538,14 @@ static short prev_word(Curve *cu)
short s;
if (cu->pos==0) return(0);
- for (s=cu->pos-2; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
- (cu->str[s]!=1) && (cu->str[s]!='\r'); s--);
- if (cu->str[s]) return(s+1); else return(s);
+ for (s = cu->pos - 2; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
+ (cu->str[s] != 1) && (cu->str[s] != '\r'));
+ s--)
+ {
+ /* pass */
+ }
+
+ return cu->str[s] ? (s + 1) : s;
}
static int kill_selection(Object *obedit, int ins) /* 1 == new character */
@@ -816,7 +825,7 @@ static int move_cursor(bContext *C, int type, int select)
EditFont *ef= cu->editfont;
int cursmove= -1;
- switch(type) {
+ switch (type) {
case LINE_BEGIN:
if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
while (cu->pos>0) {
@@ -1121,7 +1130,7 @@ static int delete_exec(bContext *C, wmOperator *op)
else if (type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
}
- switch(type) {
+ switch (type) {
case DEL_ALL:
cu->len = cu->pos = 0;
ef->textbuf[0]= 0;
@@ -1491,7 +1500,7 @@ void load_editText(Object *obedit)
void free_editText(Object *obedit)
{
- BKE_free_editfont((Curve *)obedit->data);
+ BKE_curve_editfont_free((Curve *)obedit->data);
}
/********************** set case operator *********************/
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 7726e707f08..12a54658f90 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -669,7 +669,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
// ............................
/* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */
-void draw_gpencil_2dimage (bContext *C, ImBuf *ibuf)
+void draw_gpencil_2dimage(bContext *C, ImBuf *ibuf)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -745,7 +745,7 @@ void draw_gpencil_2dimage (bContext *C, ImBuf *ibuf)
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes
*/
-void draw_gpencil_view2d (bContext *C, short onlyv2d)
+void draw_gpencil_view2d(bContext *C, short onlyv2d)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -772,7 +772,7 @@ void draw_gpencil_view2d (bContext *C, short onlyv2d)
* Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, second time with only3d=0 for screen-aligned strokes
*/
-void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
+void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d)
{
bGPdata *gpd;
int dflag = 0;
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 3b0847c2e0f..b79516ed25e 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -62,7 +62,7 @@
/* Generics - Loopers */
/* Loops over the gp-frames for a gp-layer, and applies the given callback */
-short gplayer_frames_looper (bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *))
+short gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *))
{
bGPDframe *gpf;
@@ -85,7 +85,7 @@ short gplayer_frames_looper (bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDf
/* Data Conversion Tools */
/* make a listing all the gp-frames in a layer as cfraelems */
-void gplayer_make_cfra_list (bGPDlayer *gpl, ListBase *elems, short onlysel)
+void gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, short onlysel)
{
bGPDframe *gpf;
CfraElem *ce;
@@ -111,7 +111,7 @@ void gplayer_make_cfra_list (bGPDlayer *gpl, ListBase *elems, short onlysel)
/* Selection Tools */
/* check if one of the frames in this layer is selected */
-short is_gplayer_frame_selected (bGPDlayer *gpl)
+short is_gplayer_frame_selected(bGPDlayer *gpl)
{
bGPDframe *gpf;
@@ -149,7 +149,7 @@ static void gpframe_select (bGPDframe *gpf, short select_mode)
}
/* set all/none/invert select (like above, but with SELECT_* modes) */
-void select_gpencil_frames (bGPDlayer *gpl, short select_mode)
+void select_gpencil_frames(bGPDlayer *gpl, short select_mode)
{
bGPDframe *gpf;
@@ -164,7 +164,7 @@ void select_gpencil_frames (bGPDlayer *gpl, short select_mode)
}
/* set all/none/invert select */
-void set_gplayer_frame_selection (bGPDlayer *gpl, short mode)
+void set_gplayer_frame_selection(bGPDlayer *gpl, short mode)
{
/* error checking */
if (gpl == NULL)
@@ -175,7 +175,7 @@ void set_gplayer_frame_selection (bGPDlayer *gpl, short mode)
}
/* select the frame in this layer that occurs on this frame (there should only be one at most) */
-void select_gpencil_frame (bGPDlayer *gpl, int selx, short select_mode)
+void select_gpencil_frame(bGPDlayer *gpl, int selx, short select_mode)
{
bGPDframe *gpf;
@@ -193,7 +193,7 @@ void select_gpencil_frame (bGPDlayer *gpl, int selx, short select_mode)
}
/* select the frames in this layer that occur within the bounds specified */
-void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short select_mode)
+void borderselect_gplayer_frames(bGPDlayer *gpl, float min, float max, short select_mode)
{
bGPDframe *gpf;
@@ -211,7 +211,7 @@ void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short se
/* Frame Editing Tools */
/* Delete selected frames */
-void delete_gplayer_frames (bGPDlayer *gpl)
+void delete_gplayer_frames(bGPDlayer *gpl)
{
bGPDframe *gpf, *gpfn;
@@ -229,7 +229,7 @@ void delete_gplayer_frames (bGPDlayer *gpl)
}
/* Duplicate selected frames from given gp-layer */
-void duplicate_gplayer_frames (bGPDlayer *gpl)
+void duplicate_gplayer_frames(bGPDlayer *gpl)
{
bGPDframe *gpf, *gpfn;
@@ -270,7 +270,7 @@ ListBase gpcopybuf = {NULL, NULL};
static int gpcopy_firstframe= 999999999;
/* This function frees any MEM_calloc'ed copy/paste buffer data */
-void free_gpcopybuf ()
+void free_gpcopybuf()
{
free_gpencil_layers(&gpcopybuf);
@@ -281,7 +281,7 @@ void free_gpcopybuf ()
/* This function adds data to the copy/paste buffer, freeing existing data first
* Only the selected GP-layers get their selected keyframes copied.
*/
-void copy_gpdata ()
+void copy_gpdata()
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@@ -338,7 +338,7 @@ void copy_gpdata ()
BLI_freelistN(&act_data);
}
-void paste_gpdata (Scene *scene)
+void paste_gpdata(Scene *scene)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@@ -498,7 +498,7 @@ static short snap_gpf_nearmarker (bGPDframe *gpf, Scene *scene)
/* snap selected frames to ... */
-void snap_gplayer_frames (bGPDlayer *gpl, Scene *scene, short mode)
+void snap_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
{
switch (mode) {
case 1: /* snap to nearest frame */
@@ -600,7 +600,7 @@ static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
/* mirror selected gp-frames on... */
-void mirror_gplayer_frames (bGPDlayer *gpl, Scene *scene, short mode)
+void mirror_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
{
switch (mode) {
case 1: /* mirror over current frame */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index d48cfaab63c..34a95cd89bf 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -210,7 +210,7 @@ static int gp_data_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_data_add (wmOperatorType *ot)
+void GPENCIL_OT_data_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Grease Pencil Add New";
@@ -258,7 +258,7 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_data_unlink (wmOperatorType *ot)
+void GPENCIL_OT_data_unlink(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Grease Pencil Unlink";
@@ -295,7 +295,7 @@ static int gp_layer_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_layer_add (wmOperatorType *ot)
+void GPENCIL_OT_layer_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add New Layer";
@@ -346,7 +346,7 @@ static int gp_actframe_delete_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_active_frame_delete (wmOperatorType *ot)
+void GPENCIL_OT_active_frame_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Active Frame";
@@ -534,7 +534,7 @@ static void gp_stroke_to_bezier (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, C
}
/* must calculate handles or else we crash */
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
/* add nurb to curve */
BLI_addtail(&cu->nurb, nu);
@@ -629,7 +629,7 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_convert (wmOperatorType *ot)
+void GPENCIL_OT_convert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Convert Grease Pencil";
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 0afe791029f..baa6999f552 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -70,7 +70,7 @@ void ED_keymap_gpencil(wmKeyConfig *keyconf)
/* ****************************************** */
-void ED_operatortypes_gpencil (void)
+void ED_operatortypes_gpencil(void)
{
/* Drawing ----------------------- */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index c366de6fa43..262d75a37b3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1611,7 +1611,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op)
/* loop over the stroke RNA elements recorded (i.e. progress of mouse movement),
* setting the relevant values in context at each step, then applying
*/
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
float mousef[2];
//printf("\t\tGP - stroke elem\n");
@@ -1915,7 +1915,7 @@ static EnumPropertyItem prop_gpencil_drawmodes[] = {
{0, NULL, 0, NULL, NULL}
};
-void GPENCIL_OT_draw (wmOperatorType *ot)
+void GPENCIL_OT_draw(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Grease Pencil Draw";
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index a9affbcd342..391286a2a88 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -366,7 +366,7 @@ typedef struct bAnimChannelType {
/* drawing */
/* get RGB color that is used to draw the majority of the backdrop */
- void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float *color);
+ void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3]);
/* draw backdrop strip for channel */
void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
/* get depth of indention (relative to the depth channel is nested at) */
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 5e8ef618a42..dfd0f258fc0 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -41,6 +41,9 @@ struct wmEvent;
/* clip_editor.c */
int ED_space_clip_poll(struct bContext *C);
+int ED_space_clip_tracking_poll(struct bContext *C);
+int ED_space_clip_tracking_size_poll(struct bContext *C);
+int ED_space_clip_tracking_frame_poll(struct bContext *C);
void ED_space_clip_set(struct bContext *C, struct SpaceClip *sc, struct MovieClip *clip);
struct MovieClip *ED_space_clip(struct SpaceClip *sc);
@@ -58,6 +61,8 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2]);
void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr);
void ED_clip_mouse_pos(struct bContext *C, struct wmEvent *event, float co[2]);
+int ED_space_clip_show_trackedit(struct SpaceClip *sc);
+
/* clip_ops.c */
void ED_operatormacros_clip(void);
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index 50e43c46de5..73ff8e9304d 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -63,7 +63,7 @@ void load_editNurb (struct Object *obedit);
void make_editNurb (struct Object *obedit);
void free_editNurb (struct Object *obedit);
-void free_curve_editNurb (struct Curve *cu);
+void BKE_curve_editNurb_free (struct Curve *cu);
int mouse_nurb (struct bContext *C, const int mval[2], int extend);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 4c503a2687c..71d37d5c6ea 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -71,7 +71,7 @@ struct Material;
struct Object;
struct rcti;
-intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode);
+intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode);
int mesh_mirrtopo_table(struct Object *ob, char mode);
/* editmesh_utils.c */
@@ -139,7 +139,7 @@ struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace *
void EDBM_uv_vert_map_free(struct UvVertMap *vmap);
struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v);
-struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, float *limit);
+struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]);
void EDBM_data_layer_add(struct BMEditMesh *em, struct CustomData *data, int type, const char *name);
void EDBM_data_layer_free(struct BMEditMesh *em, struct CustomData *data, int type);
@@ -158,7 +158,7 @@ extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
int mouse_mesh(struct bContext *C, const int mval[2], short extend);
-struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, int index);
+struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index);
int mesh_get_x_mirror_vert(struct Object *ob, int index);
int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
@@ -188,7 +188,7 @@ int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval
int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode);
-int paintface_minmax(struct Object *ob, float *min, float *max);
+int paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
void paintface_hide(struct Object *ob, const int unselected);
void paintface_reveal(struct Object *ob);
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index f0fffb34b73..f62befdaa31 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -66,6 +66,7 @@ void ED_region_header(const struct bContext *C, struct ARegion *ar);
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
void region_scissor_winrct(struct ARegion *ar, struct rcti *winrct);
void ED_region_info_draw(struct ARegion *ar, const char *text, int block, float alpha);
+void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
/* spaces */
void ED_spacetypes_init(void);
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 3569c0e8243..2427ed1a333 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -51,7 +51,7 @@ void ED_operatortypes_uvedit(void);
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
void ED_uvedit_assign_image(struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
-int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
+int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]);
int ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **ima, struct ImageUser **iuser, struct bNode **node);
void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima);
@@ -71,7 +71,8 @@ void uvedit_edge_select_disable(struct BMEditMesh *em, struct Scene *scene, stru
void uvedit_uv_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const short do_history);
void uvedit_uv_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l);
-int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]);
+int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima,
+ const float co[2], float r_uv[2]);
/* uvedit_unwrap_ops.c */
void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index f886c01039e..4b614085f8e 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -269,8 +269,6 @@ void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv
/* XXX should move to BLI_math */
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2);
-int lasso_inside(int mcords[][2], short moves, int sx, int sy);
-int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1);
/* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 226d9a3d493..302d5cc8a77 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -694,7 +694,7 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
}
}
if (activate || found == 0) {
- ui_button_activate_do( (bContext *)C, CTX_wm_region(C), but);
+ ui_button_activate_do((bContext *)C, CTX_wm_region(C), but);
}
else if (found && isactive == 0) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index a7ff1565c3d..d848798cc63 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -781,9 +781,8 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
act_to = (bActuator *)(to->poin);
/* (1) get the object */
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) {
- for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next)
- {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
+ for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next) {
if (&(sens_iter->links) == sens_from_links) {
ob = ob_iter;
break;
@@ -1207,7 +1206,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
but->poin = MEM_callocN(sizeof(ColorBand), "colorband");
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
- memcpy(data->coba, &but_copypaste_coba, sizeof(ColorBand) );
+ memcpy(data->coba, &but_copypaste_coba, sizeof(ColorBand));
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
}
@@ -1564,8 +1563,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
len = strlen(str);
}
- for (y = 0; y < strlen(buf); y++)
- {
+ for (y = 0; y < strlen(buf); y++) {
/* add contents of buffer */
if (len + 1 < data->maxlen) {
for (x = data->maxlen; x > but->pos; x--)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 67e295503c2..79b46fee359 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -857,7 +857,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
PointerRNA ptr;
PropertyRNA *prop;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
@@ -888,7 +888,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
EnumPropertyItem *item;
int value, free;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
@@ -926,7 +926,7 @@ void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *op
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_boolean_set(&ptr, propname, value);
@@ -939,7 +939,7 @@ void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_int_set(&ptr, propname, value);
@@ -952,7 +952,7 @@ void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opna
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_float_set(&ptr, propname, value);
@@ -965,7 +965,7 @@ void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opn
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_string_set(&ptr, propname, value);
@@ -1265,7 +1265,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
const int skip_filter = !but->changed;
/* build a temporary list of relevant items first */
- RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
+ RNA_PROP_BEGIN (&but->rnasearchpoin, itemptr, but->rnasearchprop) {
if (flag & PROP_ID_SELF_CHECK)
if (itemptr.data == but->rnapoin.id.data)
continue;
@@ -1333,7 +1333,7 @@ static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA
*prop = NULL;
- RNA_STRUCT_BEGIN(ptr, iprop) {
+ RNA_STRUCT_BEGIN (ptr, iprop) {
/* if it's a collection and has same pointer type, we've got it */
if (RNA_property_type(iprop) == PROP_COLLECTION) {
srna = RNA_property_pointer_type(ptr, iprop);
@@ -1609,7 +1609,7 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
MenuItemLevel *lvl;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
if (!ot->srna) {
ui_item_disabled(layout, opname);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index d0f760d16fb..bafd85e9451 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2362,7 +2362,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (ptr->data && prop) {
/* create list items */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
/* create button */
if (!(i % 9))
row = uiLayoutRow(col, 0);
@@ -2384,7 +2384,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (ptr->data && prop) {
/* create list items */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
found = (activei == i);
if (found) {
@@ -2446,7 +2446,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (ptr->data && prop) {
/* create list items */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
if (i >= pa->list_scroll && i < pa->list_scroll + items)
list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop, prop_list);
@@ -2703,7 +2703,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
flow = uiLayoutColumnFlow(layout, 2, 0);
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
int flag = RNA_property_flag(prop);
if (flag & PROP_HIDDEN)
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index c903040a6b9..9220491a60c 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -139,7 +139,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Pointe
assert(ELEM3(label_align, '\0', 'H', 'V'));
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
flag = RNA_property_flag(prop);
if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop) == FALSE))
continue;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index cce037822e3..fe7a4e85418 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1047,9 +1047,8 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
/* chop off the leading text, starting from the right */
while (but->strwidth > okwidth && cp2 > but->drawstr) {
- int bytes = BLI_str_utf8_size(cp2);
- if (bytes < 0)
- bytes = 1;
+ char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2);
+ int bytes = cp2 - prev_utf8;
/* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
memmove(cp2 - bytes, cp2, strlen(cp2) + 1);
@@ -1061,8 +1060,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
/* after the leading text is gone, chop off the : and following space, with ofs */
- while ((but->strwidth > okwidth) && (but->ofs < 2))
- {
+ while ((but->strwidth > okwidth) && (but->ofs < 2)) {
ui_text_clip_give_next_off(but);
but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
if (but->strwidth < 10) break;
@@ -2233,8 +2231,8 @@ int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
vec[2][0] = vec[3][0] - dist;
vec[2][1] = vec[3][1];
- forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
- forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
+ BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
+ BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
return 1;
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 9f4a351c66d..2d222059fc1 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1151,8 +1151,7 @@ void UI_ThemeClearColor(int colorid)
void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
{
- switch (axis)
- {
+ switch (axis) {
case 'X':
dst_col[0] = src_col[0] > 219 ? 255 : src_col[0] + 36;
dst_col[1] = src_col[1] < 26 ? 0 : src_col[1] - 26;
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 294a39eddf8..cfc9e11879e 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -400,14 +400,14 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
-int paintface_minmax(Object *ob, float *min, float *max)
+int paintface_minmax(Object *ob, float r_min[3], float r_max[3])
{
Mesh *me;
MPoly *mp;
MTexPoly *tf;
MLoop *ml;
MVert *mvert;
- int a, b, ok = 0;
+ int a, b, ok = FALSE;
float vec[3], bmat[3][3];
me = get_mesh(ob);
@@ -427,10 +427,10 @@ int paintface_minmax(Object *ob, float *min, float *max)
copy_v3_v3(vec, (mvert[ml->v].co));
mul_m3_v3(bmat, vec);
add_v3_v3v3(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, min, max);
+ DO_MINMAX(vec, r_min, r_max);
}
- ok = 1;
+ ok = TRUE;
}
return ok;
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index 6155ad1be1c..6d740812f27 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -239,7 +239,8 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre
}
}
-BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit)
+BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3],
+ float r_hitout[3], float r_cagehit[3])
{
BVHTreeRayHit hit;
@@ -250,10 +251,9 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo
BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree);
if (hit.dist != FLT_MAX && hit.index != -1) {
- if (hitout) {
+ if (r_hitout) {
if (tree->flag & BMBVH_RETURN_ORIG) {
BMVert *v1, *v2, *v3;
- float co[3];
int i;
v1 = tree->em->looptris[hit.index][0]->v;
@@ -261,17 +261,17 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo
v3 = tree->em->looptris[hit.index][2]->v;
for (i = 0; i < 3; i++) {
- co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
- ((v3->co[i] - v1->co[i]) * tree->uv[1]);
+ r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
+ ((v3->co[i] - v1->co[i]) * tree->uv[1]);
}
- copy_v3_v3(hitout, co);
}
else {
- copy_v3_v3(hitout, hit.co);
+ copy_v3_v3(r_hitout, hit.co);
}
- if (cagehit)
- copy_v3_v3(cagehit, hit.co);
+ if (r_cagehit) {
+ copy_v3_v3(r_cagehit, hit.co);
+ }
}
return tree->em->looptris[hit.index][0]->f;
diff --git a/source/blender/editors/mesh/editmesh_bvh.h b/source/blender/editors/mesh/editmesh_bvh.h
index e2b45062e41..6512f054c1b 100644
--- a/source/blender/editors/mesh/editmesh_bvh.h
+++ b/source/blender/editors/mesh/editmesh_bvh.h
@@ -50,13 +50,12 @@ struct BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *sc
void BMBVH_FreeBVH(struct BMBVHTree *tree);
struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree);
-struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit);
+struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, const float co[3], const float dir[3],
+ float r_hitout[3], float r_cagehit[3]);
int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e,
struct ARegion *ar, struct View3D *v3d, struct Object *obedit);
-#define BM_SEARCH_MAXDIST 0.4f
-
/*find a vert closest to co in a sphere of radius maxdist*/
struct BMVert *BMBVH_FindClosestVert(struct BMBVHTree *tree, float *co, float maxdist);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index b3bc0a1ffa9..6f33fcd05b7 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -277,7 +277,7 @@ static void knife_add_to_vert_edges(KnifeTool_OpData *kcd, KnifeEdge *kfe)
knife_append_list(kcd, &kfe->v2->edges, kfe);
}
-static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco)
+static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], float *cageco)
{
KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 12174d5b9fa..beb5345ca9b 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -240,7 +240,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
edgering_find_order(lasteed, eed, lastv1, v);
lastv1 = v[0][0];
- BLI_array_growitems(edges, previewlines);
+ BLI_array_grow_items(edges, previewlines);
for (i = 1; i <= previewlines; i++) {
co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0];
@@ -265,7 +265,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
edgering_find_order(lasteed, startedge, lastv1, v);
- BLI_array_growitems(edges, previewlines);
+ BLI_array_grow_items(edges, previewlines);
for (i = 1; i <= previewlines; i++) {
if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1])
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index e755df1f076..b74e8797d72 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -56,7 +56,8 @@
#include "mesh_intern.h"
/* helper to find edge for edge_rip */
-static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2])
+static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4],
+ const float co1[3], const float co2[2], const float mvalf[2])
{
float vec1[3], vec2[3];
@@ -111,9 +112,9 @@ static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l,
score = len_v2v2(e_v1_co, e_v2_co);
if (dist_to_line_segment_v2(fmval_tweak, e_v1_co, e_v2_co) >
- dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co))
+ dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co))
{
- return score;
+ return score;
}
else {
return -score;
@@ -262,7 +263,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
uid_start = uid;
uid = uid_end + bm->totedge;
- BLI_array_growone(eloop_pairs);
+ BLI_array_grow_one(eloop_pairs);
lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */
@@ -276,7 +277,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
}
/* null terminate */
- BLI_array_growone(eloop_pairs);
+ BLI_array_grow_one(eloop_pairs);
lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
lp->l_a = lp->l_b = NULL;
@@ -347,7 +348,7 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
BMOperator bmop;
if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b",
- BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) {
+ BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) {
return FALSE;
}
BMO_op_exec(em->bm, &bmop);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 05352938aba..32e70e798fe 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1512,7 +1512,7 @@ int mouse_mesh(bContext *C, const int mval[2], short extend)
vc.obedit->actcol = efa->mat_nr + 1;
vc.em->mat_nr = efa->mat_nr;
- WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
+ WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
}
@@ -2307,7 +2307,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
BLI_array_empty(stack);
i = 1;
- BLI_array_growone(stack);
+ BLI_array_grow_one(stack);
stack[i - 1] = f;
while (i) {
@@ -2330,7 +2330,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
/* invalidate: edge too sharp */
if (angle < sharp) {
- BLI_array_growone(stack);
+ BLI_array_grow_one(stack);
stack[i] = l2->f;
i++;
}
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index 3cbb099a0a9..36ce610c64b 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -88,7 +88,7 @@ typedef struct VertexSlideOp {
int disk_edges;
/* Edges */
- BMEdge** edge_frame;
+ BMEdge **edge_frame;
/* Slide Frame Endpoints */
float (*vtx_frame)[3];
@@ -194,7 +194,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
{
VertexSlideOp *vso = op->customdata;
BMEditMesh *em = BMEdit_FromObject(vso->obj);
- BMesh* bm = em->bm;
+ BMesh *bm = em->bm;
/* Select new edge */
BM_edge_select_set(bm, vso->sel_edge, TRUE);
@@ -204,7 +204,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
if (vso->snap_n_merge) {
float other_d;
- BMVert* other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
+ BMVert *other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
other_d = len_v3v3(vso->interp, other->co);
/* Only snap if within threshold */
@@ -339,12 +339,12 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
}
-static BMEdge* vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2])
+static BMEdge *vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2])
{
- BMEdge* cl_edge = NULL;
+ BMEdge *cl_edge = NULL;
if (vso->disk_edges > 0) {
int i = 0;
- BMEdge* edge = NULL;
+ BMEdge *edge = NULL;
float v1_proj[3], v2_proj[3];
float dist = 0;
@@ -481,7 +481,7 @@ static int vtx_slide_set_frame(VertexSlideOp *vso)
{
BMEdge *edge;
float (*vtx_frame)[3] = NULL;
- BMEdge** edge_frame = NULL;
+ BMEdge **edge_frame = NULL;
BMVert *curr_vert = NULL;
BLI_array_declare(vtx_frame);
BLI_array_declare(edge_frame);
@@ -505,7 +505,7 @@ static int vtx_slide_set_frame(VertexSlideOp *vso)
BM_ITER_ELEM_INDEX (edge, &iter, sel_vtx, BM_EDGES_OF_VERT, idx) {
curr_vert = BM_edge_other_vert(edge, sel_vtx);
if (curr_vert) {
- BLI_array_growone(vtx_frame);
+ BLI_array_grow_one(vtx_frame);
copy_v3_v3(vtx_frame[idx], curr_vert->co);
@@ -577,6 +577,7 @@ static int edbm_vertex_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
}
case RIGHTMOUSE:
+ case ESCKEY:
{
/* Enforce redraw */
ED_region_tag_redraw(vso->active_region);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index f3737925850..898e82c0660 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -927,7 +927,9 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
//"Erase Only Faces";
if (!EDBM_op_callf(em, op, "del geom=%hf context=%i",
BM_ELEM_SELECT, DEL_ONLYFACES))
+ {
return OPERATOR_CANCELLED;
+ }
}
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -1021,8 +1023,7 @@ static int edbm_add_edge_face__smooth_get(BMesh *bm)
unsigned int vote_on_smooth[2] = {0, 0};
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l)
- {
+ if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l) {
vote_on_smooth[BM_elem_flag_test_bool(e->l->f, BM_ELEM_SMOOTH)]++;
}
}
@@ -3122,10 +3123,22 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
+static void join_triangle_props(wmOperatorType *ot)
{
PropertyRNA *prop;
+ prop = RNA_def_float_rotation(ot->srna, "limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
+ "Max Angle", "Angle Limit", 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_float_default(prop, DEG2RADF(40.0f));
+
+ RNA_def_boolean(ot->srna, "uvs", 0, "Compare UVs", "");
+ RNA_def_boolean(ot->srna, "vcols", 0, "Compare VCols", "");
+ RNA_def_boolean(ot->srna, "sharp", 0, "Compare Sharp", "");
+ RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", "");
+}
+
+void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
+{
/* identifiers */
ot->name = "Tris to Quads";
ot->idname = "MESH_OT_tris_convert_to_quads";
@@ -3138,14 +3151,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop = RNA_def_float_rotation(ot->srna, "limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
- "Max Angle", "Angle Limit", 0.0f, DEG2RADF(180.0f));
- RNA_def_property_float_default(prop, DEG2RADF(40.0f));
-
- RNA_def_boolean(ot->srna, "uvs", 0, "Compare UVs", "");
- RNA_def_boolean(ot->srna, "vcols", 0, "Compare VCols", "");
- RNA_def_boolean(ot->srna, "sharp", 0, "Compare Sharp", "");
- RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", "");
+ join_triangle_props(ot);
}
static int edbm_dissolve_exec(bContext *C, wmOperator *op)
@@ -3639,22 +3645,6 @@ static int vergxco(const void *v1, const void *v2)
return (x2->org_idx < 0) - (x1->org_idx < 0);
}
-#if 0 /* Unused */
-struct facesort {
- uintptr_t x;
- struct EditFace *efa;
-};
-
-static int vergface(const void *v1, const void *v2)
-{
- const struct facesort *x1 = v1, *x2 = v2;
-
- if (x1->x > x2->x) return 1;
- else if (x1->x < x2->x) return -1;
- return 0;
-}
-#endif
-
static void xsortvert_flag__doSetX(void *userData, BMVert *UNUSED(eve), int x, int UNUSED(y), int index)
{
xvertsort *sortblock = userData;
@@ -4280,3 +4270,163 @@ void MESH_OT_inset(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset");
RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces");
}
+
+static int edbm_wireframe_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMOperator bmop;
+ const int use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
+ const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
+ const int use_replace = RNA_boolean_get(op->ptr, "use_replace");
+ const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+ const int use_crease = RNA_boolean_get(op->ptr, "use_crease");
+ const float thickness = RNA_float_get(op->ptr, "thickness");
+
+ EDBM_op_init(em, &bmop, op,
+ "wireframe faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b use_crease=%b "
+ "thickness=%f",
+ BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, use_crease,
+ thickness);
+
+ BMO_op_exec(em->bm, &bmop);
+
+ if (use_replace) {
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+
+ BMO_op_callf(em->bm, "del geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
+ }
+
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ EDBM_update_generic(C, em, TRUE);
+ return OPERATOR_FINISHED;
+ }
+}
+
+void MESH_OT_wireframe(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Wire Frame";
+ ot->idname = "MESH_OT_wireframe";
+ ot->description = "Inset new faces into selected faces";
+
+ /* api callbacks */
+ ot->exec = edbm_wireframe_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries");
+ RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
+ RNA_def_boolean(ot->srna, "use_crease", FALSE, "Crease", "Crease hub edges for improved subsurf");
+
+ prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f);
+ /* use 1 rather then 10 for max else dragging the button moves too far */
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
+
+
+ RNA_def_boolean(ot->srna, "use_replace", TRUE, "Replace", "Remove original faces");
+}
+
+static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMOperator bmop;
+
+ EDBM_op_init(em, &bmop, op, "convex_hull input=%hvef "
+ "use_existing_faces=%b",
+ BM_ELEM_SELECT,
+ RNA_boolean_get(op->ptr, "use_existing_faces"));
+ BMO_op_exec(em->bm, &bmop);
+
+ /* Hull fails if input is coplanar */
+ if (BMO_error_occurred(em->bm)) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+
+
+ /* Delete unused vertices, edges, and faces */
+ if (RNA_boolean_get(op->ptr, "delete_unused")) {
+ if(!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ &bmop, "unused_geom", DEL_ONLYTAGGED)) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ /* Delete hole edges/faces */
+ if (RNA_boolean_get(op->ptr, "make_holes")) {
+ if(!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ &bmop, "holes_geom", DEL_ONLYTAGGED)) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ /* Merge adjacent triangles */
+ if (RNA_boolean_get(op->ptr, "join_triangles")) {
+ if(!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f",
+ &bmop, "geomout",
+ RNA_float_get(op->ptr, "limit"))) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ EDBM_update_generic(C, em, TRUE);
+ EDBM_selectmode_flush(em);
+ return OPERATOR_FINISHED;
+ }
+}
+
+void MESH_OT_convex_hull(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Convex Hull";
+ ot->description = "Enclose selected vertices in a convex polyhedron";
+ ot->idname = "MESH_OT_convex_hull";
+
+ /* api callbacks */
+ ot->exec = edbm_convex_hull_exec;
+ ot->poll = EM_view3d_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "delete_unused", TRUE,
+ "Delete Unused",
+ "Delete selected elements that are not used by the hull");
+
+ RNA_def_boolean(ot->srna, "use_existing_faces", TRUE,
+ "Use Existing Faces",
+ "Skip hull triangles that are covered by a pre-existing face");
+
+ RNA_def_boolean(ot->srna, "make_holes", FALSE,
+ "Make Holes",
+ "Delete selected faces that are used by the hull");
+
+ RNA_def_boolean(ot->srna, "join_triangles", TRUE,
+ "Join Triangles",
+ "Merge adjacent triangles into quads");
+
+ join_triangle_props(ot);
+}
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 4ec3c22d1df..2ebeb9ca224 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -567,7 +567,7 @@ void undo_push_mesh(bContext *C, const char *name)
}
/* write comment here */
-UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit)
+UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2])
{
BMVert *ev;
BMFace *efa;
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 70ae9704d3e..31c130d20c9 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -106,7 +106,7 @@ void MESH_OT_duplicate(struct wmOperatorType *ot);
extern int EM_view3d_poll(struct bContext *C);
-struct wmKeyMap* knifetool_modal_keymap(struct wmKeyConfig *keyconf);
+struct wmKeyMap *knifetool_modal_keymap(struct wmKeyConfig *keyconf);
/* ******************* knifetool.c */
@@ -211,8 +211,11 @@ void MESH_OT_bevel(struct wmOperatorType *ot);
void MESH_OT_bridge_edge_loops(struct wmOperatorType *ot);
void MESH_OT_inset(struct wmOperatorType *ot);
+void MESH_OT_wireframe(struct wmOperatorType *ot);
void MESH_OT_vert_slide(struct wmOperatorType *ot);
+void MESH_OT_convex_hull(struct wmOperatorType *ot);
+
/* ******************* mesh_navmesh.c */
void MESH_OT_navmesh_make(struct wmOperatorType *ot);
void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 71aaacb7e49..43cd89af3ac 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -430,7 +430,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op)
LinkNode *obs = NULL;
Base *navmeshBase = NULL;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object->type == OB_MESH) {
if (base->object->body_type == OB_BODY_TYPE_NAVMESH) {
if (!navmeshBase || base == scene->basact) {
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 4b4fef53275..1b87e7813db 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -164,8 +164,11 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_bridge_edge_loops);
WM_operatortype_append(MESH_OT_inset);
+ WM_operatortype_append(MESH_OT_wireframe);
WM_operatortype_append(MESH_OT_edge_split);
+ WM_operatortype_append(MESH_OT_convex_hull);
+
#ifdef WITH_GAMEENGINE
WM_operatortype_append(MESH_OT_navmesh_make);
WM_operatortype_append(MESH_OT_navmesh_face_copy);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 7c02f26dbdc..1ebeea13782 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -122,7 +122,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
/* count & check */
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object->type == OB_MESH) {
me = base->object->data;
@@ -198,8 +198,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
/* first pass over objects - copying materials and vertexgroups across */
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
/* only act if a mesh, and not the one we're joining to */
if ((ob != base->object) && (base->object->type == OB_MESH)) {
me = base->object->data;
@@ -299,8 +298,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* inverse transform for all selected meshes in this object */
invert_m4_m4(imat, ob->obmat);
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
/* only join if this is a mesh */
if (base->object->type == OB_MESH) {
me = base->object->data;
@@ -569,7 +567,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
KeyBlock *kb;
int ok = 0, nonequal_verts = 0;
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object == ob) continue;
if (base->object->type == OB_MESH) {
@@ -601,8 +599,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
}
/* now ready to add new keys from selected meshes */
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object == ob) continue;
if (base->object->type == OB_MESH) {
@@ -641,13 +638,13 @@ typedef struct MocNode {
intptr_t index[MOC_NODE_RES];
} MocNode;
-static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
+static int mesh_octree_get_base_offs(const float co[3], const float offs[3], const float div[3])
{
int vx, vy, vz;
- vx = floor( (co[0] - offs[0]) / div[0]);
- vy = floor( (co[1] - offs[1]) / div[1]);
- vz = floor( (co[2] - offs[2]) / div[2]);
+ vx = floor((co[0] - offs[0]) / div[0]);
+ vy = floor((co[1] - offs[1]) / div[1]);
+ vz = floor((co[2] - offs[2]) / div[2]);
CLAMP(vx, 0, MOC_RES - 1);
CLAMP(vy, 0, MOC_RES - 1);
@@ -736,7 +733,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f
}
-static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
+static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, const float co[3])
{
float *vec;
int a;
@@ -773,7 +770,7 @@ static struct {
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
-intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
+intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode)
{
MocNode **bt;
@@ -920,7 +917,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
return 0;
}
-static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co)
+static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3])
{
float vec[3];
intptr_t poinval;
@@ -928,9 +925,10 @@ static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, f
/* ignore nan verts */
if (!finite(co[0]) ||
!finite(co[1]) ||
- !finite(co[2])
- )
+ !finite(co[2]))
+ {
return NULL;
+ }
vec[0] = -co[0];
vec[1] = co[1];
@@ -971,7 +969,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e
return NULL;
}
-BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index)
+BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index)
{
if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
@@ -1016,7 +1014,7 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
BMFace *efa;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) {
BMIter liter;
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 713009d2a19..fd842ce4f7c 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -111,7 +111,7 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNU
ml= ml->next;
}
- ml= add_metaball_element(mball, type);
+ ml= BKE_metaball_element_add(mball, type);
copy_v3_v3(&ml->x, mat[3]);
ml->flag |= SELECT;
@@ -195,7 +195,7 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
ml= mb->editelems->first;
- BLI_srand( BLI_rand() ); /* Random seed */
+ BLI_srand(BLI_rand()); /* Random seed */
/* Stupid version of random selection. Should be improved. */
while (ml) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 3717591e412..9635b1b9b62 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -111,8 +111,8 @@
void ED_object_location_from_view(bContext *C, float *loc)
{
- View3D *v3d= CTX_wm_view3d(C);
- Scene *scene= CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
float *cursor;
cursor = give_cursor(scene, v3d);
@@ -122,11 +122,11 @@ void ED_object_location_from_view(bContext *C, float *loc)
void ED_object_rotation_from_view(bContext *C, float *rot)
{
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
float quat[4];
copy_qt_qt(quat, rv3d->viewquat);
- quat[0]= -quat[0];
+ quat[0] = -quat[0];
quat_to_eul(rot, quat);
}
else {
@@ -136,8 +136,8 @@ void ED_object_rotation_from_view(bContext *C, float *rot)
void ED_object_base_init_transform(bContext *C, Base *base, float *loc, float *rot)
{
- Object *ob= base->object;
- Scene *scene= CTX_data_scene(C);
+ Object *ob = base->object;
+ Scene *scene = CTX_data_scene(C);
if (!scene) return;
@@ -195,19 +195,19 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
if (do_editmode) {
prop = RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode",
- "Enter editmode when adding this object");
- RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE);
+ "Enter editmode when adding this object");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
prop = RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
- "Location for the newly added object", -FLT_MAX, FLT_MAX);
+ "Location for the newly added object", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation",
- "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
+ "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
- RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE);
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
@@ -229,14 +229,14 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
int a, values[20], layer;
if (v3d) {
- layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact;
+ layer = (v3d->scenelock && !v3d->localvd) ? scene->layact : v3d->layact;
}
else {
layer = scene->layact;
}
- for (a=0; a<20; a++) {
- values[a]= (layer & (1<<a));
+ for (a = 0; a < 20; a++) {
+ values[a] = (layer & (1 << a));
}
RNA_boolean_set_array(op->ptr, "layers", values);
@@ -250,7 +250,7 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
}
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
- float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned)
+ float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned)
{
View3D *v3d = CTX_wm_view3d(C);
int a, layer_values[20];
@@ -263,8 +263,8 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
if (RNA_struct_property_is_set(op->ptr, "layers")) {
RNA_boolean_get_array(op->ptr, "layers", layer_values);
- *layer= 0;
- for (a=0; a<20; a++) {
+ *layer = 0;
+ for (a = 0; a < 20; a++) {
if (layer_values[a])
*layer |= (1 << a);
else
@@ -314,18 +314,18 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
/* for object add primitive operators */
/* do not call undo push in this function (users of this function have to) */
Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
- int enter_editmode, unsigned int layer)
+ int enter_editmode, unsigned int layer)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
/* for as long scene has editmode... */
if (CTX_data_edit_object(C))
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); /* freedata, and undo */
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); /* freedata, and undo */
/* deselects all, sets scene->basact */
- ob= add_object(scene, type);
+ ob = add_object(scene, type);
BASACT->lay = ob->lay = layer;
/* editor level activate, notifiers */
ED_base_object_activate(C, BASACT);
@@ -342,7 +342,7 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
if (enter_editmode)
ED_object_enter_editmode(C, EM_IGNORE_LAYER);
- WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
return ob;
}
@@ -376,7 +376,7 @@ void OBJECT_OT_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", object_type_items, 0, "Type", "");
@@ -414,23 +414,23 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return NULL;
- if (type==PFIELD_GUIDE) {
- ob= ED_object_add_type(C, OB_CURVE, loc, rot, FALSE, layer);
+ if (type == PFIELD_GUIDE) {
+ ob = ED_object_add_type(C, OB_CURVE, loc, rot, FALSE, layer);
rename_id(&ob->id, "CurveGuide");
- ((Curve*)ob->data)->flag |= CU_PATH|CU_3D;
+ ((Curve *)ob->data)->flag |= CU_PATH | CU_3D;
ED_object_enter_editmode(C, 0);
ED_object_new_primitive_matrix(C, ob, loc, rot, mat);
- BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
+ BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS | CU_PRIM_PATH, 1));
if (!enter_editmode)
ED_object_exit_editmode(C, EM_FREEDATA);
}
else {
- ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
+ ob = ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
rename_id(&ob->id, "Field");
- switch(type) {
+ switch (type) {
case PFIELD_WIND:
case PFIELD_VORTEX:
ob->empty_drawtype = OB_SINGLE_ARROW;
@@ -438,7 +438,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
}
}
- ob->pd= object_add_collision_fields(type);
+ ob->pd = object_add_collision_fields(type);
DAG_scene_sort(CTX_data_main(C), CTX_data_scene(C));
@@ -468,7 +468,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", "");
@@ -480,7 +480,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot)
static int object_camera_add_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
int enter_editmode;
unsigned int layer;
@@ -494,12 +494,12 @@ static int object_camera_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- ob= ED_object_add_type(C, OB_CAMERA, loc, rot, FALSE, layer);
+ ob = ED_object_add_type(C, OB_CAMERA, loc, rot, FALSE, layer);
if (v3d) {
if (v3d->camera == NULL)
v3d->camera = ob;
- if (v3d->scenelock && scene->camera==NULL) {
+ if (v3d->scenelock && scene->camera == NULL) {
scene->camera = ob;
}
}
@@ -521,12 +521,12 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
/* hide this for cameras, default */
- prop= RNA_struct_type_find_property(ot->srna, "view_align");
+ prop = RNA_struct_type_find_property(ot->srna, "view_align");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -535,9 +535,9 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
/* ***************** add primitives *************** */
static int object_metaball_add_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
/*MetaElem *elem;*/ /*UNUSED*/
- int newob= 0;
+ int newob = 0;
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -548,8 +548,8 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if (obedit==NULL || obedit->type!=OB_MBALL) {
- obedit= ED_object_add_type(C, OB_MBALL, loc, rot, TRUE, layer);
+ if (obedit == NULL || obedit->type != OB_MBALL) {
+ obedit = ED_object_add_type(C, OB_MBALL, loc, rot, TRUE, layer);
newob = 1;
}
else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
@@ -563,21 +563,21 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
ED_object_exit_editmode(C, EM_FREEDATA);
}
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
uiPopupMenu *pup;
uiLayout *layout;
object_add_generic_invoke_options(C, op);
- pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+ layout = uiPupMenuLayout(pup);
if (!obedit || obedit->type == OB_MBALL)
uiItemsEnumO(layout, op->type->idname, "type");
else
@@ -600,7 +600,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", metaelem_type_items, 0, "Primitive", "");
ED_object_add_generic_props(ot, TRUE);
@@ -608,7 +608,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot)
static int object_add_text_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -617,12 +617,12 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if (obedit && obedit->type==OB_FONT)
+ if (obedit && obedit->type == OB_FONT)
return OPERATOR_CANCELLED;
- obedit= ED_object_add_type(C, OB_FONT, loc, rot, enter_editmode, layer);
+ obedit = ED_object_add_type(C, OB_FONT, loc, rot, enter_editmode, layer);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
@@ -640,16 +640,16 @@ void OBJECT_OT_text_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
static int object_armature_add_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
- View3D *v3d= CTX_wm_view3d(C);
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
- int newob= 0;
+ Object *obedit = CTX_data_edit_object(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ int newob = 0;
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -658,14 +658,14 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if ((obedit==NULL) || (obedit->type != OB_ARMATURE)) {
- obedit= ED_object_add_type(C, OB_ARMATURE, loc, rot, TRUE, layer);
+ if ((obedit == NULL) || (obedit->type != OB_ARMATURE)) {
+ obedit = ED_object_add_type(C, OB_ARMATURE, loc, rot, TRUE, layer);
ED_object_enter_editmode(C, 0);
newob = 1;
}
else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
- if (obedit==NULL) {
+ if (obedit == NULL) {
BKE_report(op->reports, RPT_ERROR, "Cannot create editmode armature");
return OPERATOR_CANCELLED;
}
@@ -677,7 +677,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
if (newob && !enter_editmode)
ED_object_exit_editmode(C, EM_FREEDATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
@@ -695,7 +695,7 @@ void OBJECT_OT_armature_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -714,10 +714,10 @@ static const char *get_lamp_defname(int type)
static int object_lamp_add_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
Lamp *la;
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -726,16 +726,16 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- ob= ED_object_add_type(C, OB_LAMP, loc, rot, FALSE, layer);
- la= (Lamp*)ob->data;
+ ob = ED_object_add_type(C, OB_LAMP, loc, rot, FALSE, layer);
+ la = (Lamp *)ob->data;
- la->type= type;
+ la->type = type;
rename_id(&ob->id, get_lamp_defname(type));
rename_id(&la->id, get_lamp_defname(type));
if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &la->id);
- la->use_nodes= 1;
+ la->use_nodes = 1;
}
return OPERATOR_FINISHED;
@@ -762,7 +762,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", "");
@@ -772,7 +772,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
static int group_instance_add_exec(bContext *C, wmOperator *op)
{
- Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
+ Group *group = BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
int enter_editmode;
unsigned int layer;
@@ -783,18 +783,18 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if (group) {
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
- rename_id(&ob->id, group->id.name+2);
- ob->dup_group= group;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
+ rename_id(&ob->id, group->id.name + 2);
+ ob->dup_group = group;
ob->transflag |= OB_DUPLIGROUP;
id_lib_extern(&group->id);
/* works without this except if you try render right after, see: 22027 */
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -814,7 +814,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
+ ob = ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
/* to make it easier to start using this immediately in NLA, a default sound clip is created
* ready to be moved around to retime the sound and/or make new sound clips
@@ -834,7 +834,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
strcpy(nlt->name, "SoundTrack");
BKE_nlastrip_validate_name(adt, strip);
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
}
return OPERATOR_FINISHED;
@@ -852,7 +852,7 @@ void OBJECT_OT_speaker_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -874,10 +874,10 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
RNA_def_enum_funcs(prop, RNA_group_itemf);
ot->prop = prop;
ED_object_add_generic_props(ot, FALSE);
@@ -892,21 +892,21 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
DAG_id_type_tag(bmain, ID_OB);
BLI_remlink(&scene->base, base);
free_libblock_us(&bmain->object, base->object);
- if (scene->basact==base) scene->basact= NULL;
+ if (scene->basact == base) scene->basact = NULL;
MEM_freeN(base);
}
static int object_delete_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- const short use_global= RNA_boolean_get(op->ptr, "use_global");
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ const short use_global = RNA_boolean_get(op->ptr, "use_global");
/* int islamp= 0; */ /* UNUSED */
if (CTX_data_edit_object(C))
return OPERATOR_CANCELLED;
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
/* if (base->object->type==OB_LAMP) islamp= 1; */
@@ -920,9 +920,9 @@ static int object_delete_exec(bContext *C, wmOperator *op)
Scene *scene_iter;
Base *base_other;
- for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
+ for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
if (scene_iter != scene && !(scene_iter->id.lib)) {
- base_other= object_in_scene(base->object, scene_iter);
+ base_other = object_in_scene(base->object, scene_iter);
if (base_other) {
ED_base_object_free_and_unlink(bmain, scene_iter, base_other);
}
@@ -937,8 +937,8 @@ static int object_delete_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}
@@ -956,7 +956,7 @@ void OBJECT_OT_delete(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "use_global", 0, "Delete Globally", "Remove object from all scenes");
}
@@ -966,81 +966,81 @@ void OBJECT_OT_delete(wmOperatorType *ot)
/* after copying objects, copied data should get new pointers */
static void copy_object_set_idnew(bContext *C, int dupflag)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Material *ma, *mao;
ID *id;
int a;
/* XXX check object pointers */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
object_relink(ob);
}
CTX_DATA_END;
/* materials */
- if ( dupflag & USER_DUP_MAT) {
- mao= bmain->mat.first;
+ if (dupflag & USER_DUP_MAT) {
+ mao = bmain->mat.first;
while (mao) {
if (mao->id.newid) {
- ma= (Material *)mao->id.newid;
+ ma = (Material *)mao->id.newid;
if (dupflag & USER_DUP_TEX) {
- for (a=0; a<MAX_MTEX; a++) {
+ for (a = 0; a < MAX_MTEX; a++) {
if (ma->mtex[a]) {
- id= (ID *)ma->mtex[a]->tex;
+ id = (ID *)ma->mtex[a]->tex;
if (id) {
ID_NEW_US(ma->mtex[a]->tex)
- else ma->mtex[a]->tex= copy_texture(ma->mtex[a]->tex);
+ else ma->mtex[a]->tex = copy_texture(ma->mtex[a]->tex);
id->us--;
}
}
}
}
#if 0 // XXX old animation system
- id= (ID *)ma->ipo;
+ id = (ID *)ma->ipo;
if (id) {
ID_NEW_US(ma->ipo)
- else ma->ipo= copy_ipo(ma->ipo);
+ else ma->ipo = copy_ipo(ma->ipo);
id->us--;
}
#endif // XXX old animation system
}
- mao= mao->id.next;
+ mao = mao->id.next;
}
}
#if 0 // XXX old animation system
- /* lamps */
- if ( dupflag & USER_DUP_IPO) {
- Lamp *la= bmain->lamp.first;
+ /* lamps */
+ if (dupflag & USER_DUP_IPO) {
+ Lamp *la = bmain->lamp.first;
while (la) {
if (la->id.newid) {
- Lamp *lan= (Lamp *)la->id.newid;
- id= (ID *)lan->ipo;
+ Lamp *lan = (Lamp *)la->id.newid;
+ id = (ID *)lan->ipo;
if (id) {
ID_NEW_US(lan->ipo)
- else lan->ipo= copy_ipo(lan->ipo);
+ else lan->ipo = copy_ipo(lan->ipo);
id->us--;
}
}
- la= la->id.next;
+ la = la->id.next;
}
}
/* ipos */
- ipo= bmain->ipo.first;
+ ipo = bmain->ipo.first;
while (ipo) {
- if (ipo->id.lib==NULL && ipo->id.newid) {
- Ipo *ipon= (Ipo *)ipo->id.newid;
+ if (ipo->id.lib == NULL && ipo->id.newid) {
+ Ipo *ipon = (Ipo *)ipo->id.newid;
IpoCurve *icu;
- for (icu= ipon->curve.first; icu; icu= icu->next) {
+ for (icu = ipon->curve.first; icu; icu = icu->next) {
if (icu->driver) {
ID_NEW(icu->driver->ob);
}
}
}
- ipo= ipo->id.next;
+ ipo = ipo->id.next;
}
#endif // XXX old animation system
@@ -1057,42 +1057,42 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
{
ListBase *lb;
DupliObject *dob;
- GHash *dupli_gh= NULL, *parent_gh= NULL;
+ GHash *dupli_gh = NULL, *parent_gh = NULL;
if (!(base->object->transflag & OB_DUPLI))
return;
- lb= object_duplilist(scene, base->object);
+ lb = object_duplilist(scene, base->object);
if (use_hierarchy || use_base_parent) {
- dupli_gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
- parent_gh= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
+ dupli_gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
+ parent_gh = BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
}
- for (dob= lb->first; dob; dob= dob->next) {
+ for (dob = lb->first; dob; dob = dob->next) {
Base *basen;
- Object *ob= copy_object(dob->ob);
+ Object *ob = copy_object(dob->ob);
/* font duplis can have a totcol without material, we get them from parent
* should be implemented better...
*/
- if (ob->mat==NULL) ob->totcol= 0;
+ if (ob->mat == NULL) ob->totcol = 0;
- basen= MEM_dupallocN(base);
- basen->flag &= ~(OB_FROMDUPLI|OB_FROMGROUP);
- ob->flag= basen->flag;
- basen->lay= base->lay;
- BLI_addhead(&scene->base, basen); /* addhead: othwise eternal loop */
- basen->object= ob;
+ basen = MEM_dupallocN(base);
+ basen->flag &= ~(OB_FROMDUPLI | OB_FROMGROUP);
+ ob->flag = basen->flag;
+ basen->lay = base->lay;
+ BLI_addhead(&scene->base, basen); /* addhead: othwise eternal loop */
+ basen->object = ob;
/* make sure apply works */
BKE_free_animdata(&ob->id);
ob->adt = NULL;
- ob->parent= NULL;
- ob->constraints.first= ob->constraints.last= NULL;
- ob->disp.first= ob->disp.last= NULL;
+ ob->parent = NULL;
+ ob->constraints.first = ob->constraints.last = NULL;
+ ob->disp.first = ob->disp.last = NULL;
ob->transflag &= ~OB_DUPLI;
- ob->lay= base->lay;
+ ob->lay = base->lay;
copy_m4_m4(ob->obmat, dob->mat);
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
@@ -1104,13 +1104,13 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
if (use_hierarchy) {
- for (dob= lb->first; dob; dob= dob->next) {
+ for (dob = lb->first; dob; dob = dob->next) {
/* original parents */
- Object *ob_src= dob->ob;
- Object *ob_src_par= ob_src->parent;
+ Object *ob_src = dob->ob;
+ Object *ob_src_par = ob_src->parent;
- Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
- Object *ob_dst_par= NULL;
+ Object *ob_dst = BLI_ghash_lookup(dupli_gh, dob);
+ Object *ob_dst_par = NULL;
/* find parent that was also made real */
if (ob_src_par) {
@@ -1121,19 +1121,19 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
if (ob_dst_par) {
/* allow for all possible parent types */
- ob_dst->partype= ob_src->partype;
+ ob_dst->partype = ob_src->partype;
BLI_strncpy(ob_dst->parsubstr, ob_src->parsubstr, sizeof(ob_dst->parsubstr));
- ob_dst->par1= ob_src->par1;
- ob_dst->par2= ob_src->par2;
- ob_dst->par3= ob_src->par3;
+ ob_dst->par1 = ob_src->par1;
+ ob_dst->par2 = ob_src->par2;
+ ob_dst->par3 = ob_src->par3;
copy_m4_m4(ob_dst->parentinv, ob_src->parentinv);
- ob_dst->parent= ob_dst_par;
+ ob_dst->parent = ob_dst_par;
}
else if (use_base_parent) {
- ob_dst->parent= base->object;
- ob_dst->partype= PAROBJECT;
+ ob_dst->parent = base->object;
+ ob_dst->partype = PAROBJECT;
}
if (ob_dst->parent) {
@@ -1151,12 +1151,12 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
else if (use_base_parent) {
/* since we are ignoring the internal hierarchy - parent all to the
* base object */
- for (dob= lb->first; dob; dob= dob->next) {
+ for (dob = lb->first; dob; dob = dob->next) {
/* original parents */
- Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
+ Object *ob_dst = BLI_ghash_lookup(dupli_gh, dob);
- ob_dst->parent= base->object;
- ob_dst->partype= PAROBJECT;
+ ob_dst->parent = base->object;
+ ob_dst->partype = PAROBJECT;
/* similer to the code above, see comments */
invert_m4_m4(ob_dst->parentinv, dob->mat);
@@ -1181,26 +1181,26 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- const short use_base_parent= RNA_boolean_get(op->ptr, "use_base_parent");
- const short use_hierarchy= RNA_boolean_get(op->ptr, "use_hierarchy");
+ const short use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent");
+ const short use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy");
clear_id_newpoins();
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
make_object_duplilist_real(C, scene, base, use_base_parent, use_hierarchy);
/* dependencies were changed */
- WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, base->object);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, base->object);
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SCENE, scene);
- WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
return OPERATOR_FINISHED;
}
@@ -1219,7 +1219,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "use_base_parent", 0, "Parent", "Parent newly created objects to the original duplicator");
RNA_def_boolean(ot->srna, "use_hierarchy", 0, "Keep Hierarchy", "Maintain parent child relationships");
@@ -1227,15 +1227,16 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
/**************************** Convert **************************/
-static EnumPropertyItem convert_target_items[]= {
+static EnumPropertyItem convert_target_items[] = {
{OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve from Mesh/Text", ""},
{OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh from Curve/Meta/Surf/Text", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+};
static void curvetomesh(Scene *scene, Object *ob)
{
if (ob->disp.first == NULL)
- makeDispListCurveTypes(scene, ob, 0); /* force creation */
+ makeDispListCurveTypes(scene, ob, 0); /* force creation */
nurbs_to_mesh(ob); /* also does users */
@@ -1245,8 +1246,8 @@ static void curvetomesh(Scene *scene, Object *ob)
static int convert_poll(bContext *C)
{
- Object *obact= CTX_data_active_object(C);
- Scene *scene= CTX_data_scene(C);
+ Object *obact = CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
return (!scene->id.lib && obact && scene->obedit != obact && (obact->flag & SELECT) && !(obact->id.lib));
}
@@ -1258,16 +1259,16 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
Base *basen;
if (ob == NULL) {
- ob= base->object;
+ ob = base->object;
}
- obn= copy_object(ob);
- obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ obn = copy_object(ob);
+ obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&scene->base, basen); /* addhead: otherwise eternal loop */
- basen->object= obn;
+ basen = MEM_mallocN(sizeof(Base), "duplibase");
+ *basen = *base;
+ BLI_addhead(&scene->base, basen); /* addhead: otherwise eternal loop */
+ basen->object = obn;
basen->flag |= SELECT;
obn->flag |= SELECT;
base->flag &= ~SELECT;
@@ -1278,24 +1279,24 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
static int convert_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Base *basen=NULL, *basact=NULL, *basedel=NULL;
- Object *ob, *ob1, *newob, *obact= CTX_data_active_object(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Base *basen = NULL, *basact = NULL, *basedel = NULL;
+ Object *ob, *ob1, *newob, *obact = CTX_data_active_object(C);
DerivedMesh *dm;
Curve *cu;
Nurb *nu;
MetaBall *mb;
Mesh *me;
- const short target= RNA_enum_get(op->ptr, "target");
- const short keep_original= RNA_boolean_get(op->ptr, "keep_original");
- int a, mballConverted= 0;
+ const short target = RNA_enum_get(op->ptr, "target");
+ const short keep_original = RNA_boolean_get(op->ptr, "keep_original");
+ int a, mballConverted = 0;
/* don't forget multiple users! */
/* reset flags */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- ob= base->object;
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ ob = base->object;
ob->flag &= ~OB_DONE;
/* flag data thats not been edited (only needed for !keep_original) */
@@ -1305,8 +1306,8 @@ static int convert_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- ob= base->object;
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ ob = base->object;
if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
if (ob->type != target) {
@@ -1319,23 +1320,23 @@ static int convert_exec(bContext *C, wmOperator *op)
/* When 2 objects with linked data are selected, converting both
* would keep modifiers on all but the converted object [#26003] */
if (ob->type == OB_MESH) {
- object_free_modifiers(ob); /* after derivedmesh calls! */
+ object_free_modifiers(ob); /* after derivedmesh calls! */
}
}
}
- else if (ob->type==OB_MESH && target == OB_CURVE) {
+ else if (ob->type == OB_MESH && target == OB_CURVE) {
ob->flag |= OB_DONE;
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original mesh's usage count */
- me= newob->data;
+ me = newob->data;
me->id.us--;
/* make a new copy of the mesh */
- newob->data= copy_mesh(me);
+ newob->data = copy_mesh(me);
}
else {
newob = ob;
@@ -1343,33 +1344,33 @@ static int convert_exec(bContext *C, wmOperator *op)
mesh_to_curve(scene, newob);
- if (newob->type==OB_CURVE)
- object_free_modifiers(newob); /* after derivedmesh calls! */
+ if (newob->type == OB_CURVE)
+ object_free_modifiers(newob); /* after derivedmesh calls! */
}
- else if (ob->type==OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
+ else if (ob->type == OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
ob->flag |= OB_DONE;
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original mesh's usage count */
- me= newob->data;
+ me = newob->data;
me->id.us--;
/* make a new copy of the mesh */
- newob->data= copy_mesh(me);
+ newob->data = copy_mesh(me);
}
else {
newob = ob;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
}
/* make new mesh data from the original copy */
/* note: get the mesh from the original, not from the copy in some
* cases this doesnt give correct results (when MDEF is used for eg)
*/
- dm= mesh_get_derived_final(scene, newob, CD_MASK_MESH);
+ dm = mesh_get_derived_final(scene, newob, CD_MASK_MESH);
/* dm= mesh_create_derived_no_deform(ob1, NULL); this was called original (instead of get_derived). man o man why! (ton) */
DM_to_mesh(dm, newob->data, newob);
@@ -1377,64 +1378,64 @@ static int convert_exec(bContext *C, wmOperator *op)
/* re-tessellation is called by DM_to_mesh */
dm->release(dm);
- object_free_modifiers(newob); /* after derivedmesh calls! */
+ object_free_modifiers(newob); /* after derivedmesh calls! */
}
- else if (ob->type==OB_FONT) {
+ else if (ob->type == OB_FONT) {
ob->flag |= OB_DONE;
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original curve's usage count */
((Curve *)newob->data)->id.us--;
/* make a new copy of the curve */
- newob->data= copy_curve(ob->data);
+ newob->data = BKE_curve_copy(ob->data);
}
else {
- newob= ob;
+ newob = ob;
}
- cu= newob->data;
+ cu = newob->data;
if (!newob->disp.first)
makeDispListCurveTypes(scene, newob, 0);
- newob->type= OB_CURVE;
- cu->type= OB_CURVE;
+ newob->type = OB_CURVE;
+ cu->type = OB_CURVE;
if (cu->vfont) {
cu->vfont->id.us--;
- cu->vfont= NULL;
+ cu->vfont = NULL;
}
if (cu->vfontb) {
cu->vfontb->id.us--;
- cu->vfontb= NULL;
+ cu->vfontb = NULL;
}
if (cu->vfonti) {
cu->vfonti->id.us--;
- cu->vfonti= NULL;
+ cu->vfonti = NULL;
}
if (cu->vfontbi) {
cu->vfontbi->id.us--;
- cu->vfontbi= NULL;
+ cu->vfontbi = NULL;
}
if (!keep_original) {
/* other users */
- if (cu->id.us>1) {
- for (ob1= bmain->object.first; ob1; ob1=ob1->id.next) {
- if (ob1->data==ob->data) {
- ob1->type= OB_CURVE;
- ob1->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ if (cu->id.us > 1) {
+ for (ob1 = bmain->object.first; ob1; ob1 = ob1->id.next) {
+ if (ob1->data == ob->data) {
+ ob1->type = OB_CURVE;
+ ob1->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
}
}
}
}
- for (nu=cu->nurb.first; nu; nu=nu->next)
- nu->charidx= 0;
+ for (nu = cu->nurb.first; nu; nu = nu->next)
+ nu->charidx = 0;
if (target == OB_MESH) {
curvetomesh(scene, newob);
@@ -1448,17 +1449,17 @@ static int convert_exec(bContext *C, wmOperator *op)
if (target == OB_MESH) {
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original curve's usage count */
((Curve *)newob->data)->id.us--;
/* make a new copy of the curve */
- newob->data= copy_curve(ob->data);
+ newob->data = BKE_curve_copy(ob->data);
}
else {
- newob= ob;
+ newob = ob;
/* meshes doesn't use displist */
freedisplist(&newob->disp);
@@ -1467,13 +1468,13 @@ static int convert_exec(bContext *C, wmOperator *op)
curvetomesh(scene, newob);
}
}
- else if (ob->type==OB_MBALL && target == OB_MESH) {
+ else if (ob->type == OB_MBALL && target == OB_MESH) {
Object *baseob;
base->flag &= ~SELECT;
ob->flag &= ~SELECT;
- baseob= find_basis_mball(scene, ob);
+ baseob = BKE_metaball_basis_find(scene, ob);
if (ob != baseob) {
/* if motherball is converting it would be marked as done later */
@@ -1487,29 +1488,29 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!(baseob->flag & OB_DONE)) {
baseob->flag |= OB_DONE;
- basen= duplibase_for_convert(scene, base, baseob);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, baseob);
+ newob = basen->object;
- mb= newob->data;
+ mb = newob->data;
mb->id.us--;
- newob->data= add_mesh("Mesh");
- newob->type= OB_MESH;
+ newob->data = add_mesh("Mesh");
+ newob->type = OB_MESH;
- me= newob->data;
- me->totcol= mb->totcol;
+ me = newob->data;
+ me->totcol = mb->totcol;
if (newob->totcol) {
- me->mat= MEM_dupallocN(mb->mat);
- for (a=0; a<newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
+ me->mat = MEM_dupallocN(mb->mat);
+ for (a = 0; a < newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
}
mball_to_mesh(&baseob->disp, newob->data);
if (obact->type == OB_MBALL) {
- basact= basen;
+ basact = basen;
}
- mballConverted= 1;
+ mballConverted = 1;
}
}
else {
@@ -1522,10 +1523,10 @@ static int convert_exec(bContext *C, wmOperator *op)
if (basen) {
if (ob == obact) {
/* store new active base to update BASACT */
- basact= basen;
+ basact = basen;
}
- basen= NULL;
+ basen = NULL;
}
if (!keep_original && (ob->flag & OB_DONE)) {
@@ -1545,11 +1546,11 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!keep_original) {
if (mballConverted) {
- Base *base= scene->base.first, *tmpbase;
+ Base *base = scene->base.first, *tmpbase;
while (base) {
- ob= base->object;
- tmpbase= base;
- base= base->next;
+ ob = base->object;
+ tmpbase = base;
+ base = base->next;
if (ob->type == OB_MBALL) {
ED_base_object_free_and_unlink(bmain, scene, tmpbase);
@@ -1567,16 +1568,16 @@ static int convert_exec(bContext *C, wmOperator *op)
if (basact) {
/* active base was changed */
ED_base_object_activate(C, basact);
- BASACT= basact;
+ BASACT = basact;
}
else if (BASACT->object->flag & OB_DONE) {
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, BASACT->object);
- WM_event_add_notifier(C, NC_OBJECT|ND_DATA, BASACT->object);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, BASACT->object);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DATA, BASACT->object);
}
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
}
@@ -1595,7 +1596,7 @@ void OBJECT_OT_convert(wmOperatorType *ot)
ot->poll = convert_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to");
@@ -1614,28 +1615,28 @@ void OBJECT_OT_convert(wmOperatorType *ot)
/* leaves selection of base/object unaltered */
static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base, int dupflag)
{
- Base *basen= NULL;
+ Base *basen = NULL;
Material ***matarar;
Object *ob, *obn;
ID *id;
int a, didit;
- ob= base->object;
+ ob = base->object;
if (ob->mode & OB_MODE_POSE) {
; /* nothing? */
}
else {
- obn= copy_object(ob);
- obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ obn = copy_object(ob);
+ obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
- basen->object= obn;
+ basen = MEM_mallocN(sizeof(Base), "duplibase");
+ *basen = *base;
+ BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
+ basen->object = obn;
if (basen->flag & OB_FROMGROUP) {
Group *group;
- for (group= bmain->group.first; group; group= group->id.next) {
+ for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group))
add_to_group(group, obn, scene, basen);
}
@@ -1647,11 +1648,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
if (dupflag & USER_DUP_MAT) {
- for (a=0; a<obn->totcol; a++) {
- id= (ID *)obn->mat[a];
+ for (a = 0; a < obn->totcol; a++) {
+ id = (ID *)obn->mat[a];
if (id) {
ID_NEW_US(obn->mat[a])
- else obn->mat[a]= copy_material(obn->mat[a]);
+ else obn->mat[a] = copy_material(obn->mat[a]);
id->us--;
if (dupflag & USER_DUP_ACT) {
@@ -1662,11 +1663,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
if (dupflag & USER_DUP_PSYS) {
ParticleSystem *psys;
- for (psys=obn->particlesystem.first; psys; psys=psys->next) {
- id= (ID*) psys->part;
+ for (psys = obn->particlesystem.first; psys; psys = psys->next) {
+ id = (ID *) psys->part;
if (id) {
ID_NEW_US(psys->part)
- else psys->part= psys_copy_settings(psys->part);
+ else psys->part = psys_copy_settings(psys->part);
if (dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&psys->part->id);
@@ -1677,71 +1678,71 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
}
- id= obn->data;
- didit= 0;
+ id = obn->data;
+ didit = 0;
- switch(obn->type) {
+ switch (obn->type) {
case OB_MESH:
if (dupflag & USER_DUP_MESH) {
- ID_NEW_US2( obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_mesh(obn->data);
+ obn->data = copy_mesh(obn->data);
if (obn->fluidsimSettings) {
obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
}
- didit= 1;
+ didit = 1;
}
id->us--;
}
break;
case OB_CURVE:
if (dupflag & USER_DUP_CURVE) {
- ID_NEW_US2(obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_curve(obn->data);
- didit= 1;
+ obn->data = BKE_curve_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_SURF:
if (dupflag & USER_DUP_SURF) {
- ID_NEW_US2( obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_curve(obn->data);
- didit= 1;
+ obn->data = BKE_curve_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_FONT:
if (dupflag & USER_DUP_FONT) {
- ID_NEW_US2( obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_curve(obn->data);
- didit= 1;
+ obn->data = BKE_curve_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_MBALL:
if (dupflag & USER_DUP_MBALL) {
- ID_NEW_US2(obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_mball(obn->data);
- didit= 1;
+ obn->data = BKE_metaball_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_LAMP:
if (dupflag & USER_DUP_LAMP) {
- ID_NEW_US2(obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_lamp(obn->data);
- didit= 1;
+ obn->data = copy_lamp(obn->data);
+ didit = 1;
}
id->us--;
}
@@ -1751,44 +1752,44 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->recalc |= OB_RECALC_DATA;
if (obn->pose) obn->pose->flag |= POSE_RECALC;
- if (dupflag & USER_DUP_ARM) {
- ID_NEW_US2(obn->data )
- else {
- obn->data= copy_armature(obn->data);
- armature_rebuild_pose(obn, obn->data);
- didit= 1;
- }
- id->us--;
+ if (dupflag & USER_DUP_ARM) {
+ ID_NEW_US2(obn->data)
+ else {
+ obn->data = copy_armature(obn->data);
+ armature_rebuild_pose(obn, obn->data);
+ didit = 1;
}
+ id->us--;
+ }
- break;
+ break;
case OB_LATTICE:
- if (dupflag!=0) {
- ID_NEW_US2(obn->data )
+ if (dupflag != 0) {
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_lattice(obn->data);
- didit= 1;
+ obn->data = copy_lattice(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_CAMERA:
- if (dupflag!=0) {
- ID_NEW_US2(obn->data )
+ if (dupflag != 0) {
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_camera(obn->data);
- didit= 1;
+ obn->data = copy_camera(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_SPEAKER:
- if (dupflag!=0) {
- ID_NEW_US2(obn->data )
+ if (dupflag != 0) {
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_speaker(obn->data);
- didit= 1;
+ obn->data = copy_speaker(obn->data);
+ didit = 1;
}
id->us--;
}
@@ -1805,13 +1806,13 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
BKE_copy_animdata_id_action((ID *)obn->data);
if (key) {
- BKE_copy_animdata_id_action((ID*)key);
+ BKE_copy_animdata_id_action((ID *)key);
}
/* Update the duplicated action in the action actuators */
for (act = obn->actuators.first; act; act = act->next) {
if (act->type == ACT_ACTION) {
- bActionActuator* actact = (bActionActuator*) act->data;
+ bActionActuator *actact = (bActionActuator *) act->data;
if (ob->adt && actact->act == ob->adt->action) {
actact->act = obn->adt->action;
}
@@ -1820,13 +1821,13 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
if (dupflag & USER_DUP_MAT) {
- matarar= give_matarar(obn);
+ matarar = give_matarar(obn);
if (matarar) {
- for (a=0; a<obn->totcol; a++) {
- id= (ID *)(*matarar)[a];
+ for (a = 0; a < obn->totcol; a++) {
+ id = (ID *)(*matarar)[a];
if (id) {
- ID_NEW_US( (*matarar)[a] )
- else (*matarar)[a]= copy_material((*matarar)[a]);
+ ID_NEW_US((*matarar)[a])
+ else (*matarar)[a] = copy_material((*matarar)[a]);
id->us--;
}
@@ -1847,14 +1848,14 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
Object *ob;
clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
- basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
+ basen = object_add_duplicate_internal(bmain, scene, base, dupflag);
if (basen == NULL) {
return NULL;
}
- ob= basen->object;
+ ob = basen->object;
/* link own references to the newly duplicated data [#26816] */
object_relink(ob);
@@ -1871,16 +1872,16 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
/* contextual operator dupli */
static int duplicate_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- int linked= RNA_boolean_get(op->ptr, "linked");
- int dupflag= (linked)? 0: U.dupflag;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int linked = RNA_boolean_get(op->ptr, "linked");
+ int dupflag = (linked) ? 0 : U.dupflag;
clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- Base *basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ Base *basen = object_add_duplicate_internal(bmain, scene, base, dupflag);
/* note that this is safe to do with this context iterator,
* the list is made in advance */
@@ -1891,7 +1892,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
}
/* new object becomes active */
- if (BASACT==base)
+ if (BASACT == base)
ED_base_object_activate(C, basen);
if (basen->object->data) {
@@ -1905,7 +1906,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
}
@@ -1924,11 +1925,11 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* to give to transform */
RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
- prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -1937,36 +1938,36 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
static int add_named_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Base *basen, *base;
Object *ob;
- int linked= RNA_boolean_get(op->ptr, "linked");
- int dupflag= (linked)? 0: U.dupflag;
- char name[MAX_ID_NAME-2];
+ int linked = RNA_boolean_get(op->ptr, "linked");
+ int dupflag = (linked) ? 0 : U.dupflag;
+ char name[MAX_ID_NAME - 2];
/* find object, create fake base */
RNA_string_get(op->ptr, "name", name);
- ob= (Object *)find_id("OB", name);
- if (ob==NULL)
+ ob = (Object *)find_id("OB", name);
+ if (ob == NULL)
return OPERATOR_CANCELLED;
- base= MEM_callocN(sizeof(Base), "duplibase");
- base->object= ob;
- base->flag= ob->flag;
+ base = MEM_callocN(sizeof(Base), "duplibase");
+ base->object = ob;
+ base->flag = ob->flag;
/* prepare dupli */
clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
- basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
+ basen = object_add_duplicate_internal(bmain, scene, base, dupflag);
if (basen == NULL) {
MEM_freeN(base);
return OPERATOR_CANCELLED;
}
- basen->lay= basen->object->lay= scene->lay;
+ basen->lay = basen->object->lay = scene->lay;
ED_object_location_from_view(C, basen->object->loc);
ED_base_object_activate(C, basen);
@@ -1978,7 +1979,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
MEM_freeN(base);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
}
@@ -1995,10 +1996,10 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
- RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
+ RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME - 2, "Name", "Object name to add");
}
@@ -2006,7 +2007,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
/**************************** Join *************************/
static int join_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
if (!ob || ob->id.lib) return 0;
@@ -2019,8 +2020,8 @@ static int join_poll(bContext *C)
static int join_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
if (scene->obedit) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
@@ -2053,13 +2054,13 @@ void OBJECT_OT_join(wmOperatorType *ot)
ot->poll = join_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/**************************** Join as Shape Key*************************/
static int join_shapes_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
if (!ob || ob->id.lib) return 0;
@@ -2072,8 +2073,8 @@ static int join_shapes_poll(bContext *C)
static int join_shapes_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
if (scene->obedit) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
@@ -2102,5 +2103,5 @@ void OBJECT_OT_join_shapes(wmOperatorType *ot)
ot->poll = join_shapes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 1f012c6f0be..9e8381a72c6 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -115,9 +115,9 @@ typedef void (*MPassKnownData)(DerivedMesh *lores_dm, DerivedMesh *hires_dm, con
const int face_index, const int lvl, const float st[2],
float tangmat[3][3], const int x, const int y);
-typedef void* (*MInitBakeData)(MultiresBakeRender *bkr, Image* ima);
-typedef void (*MApplyBakeData)(void *bake_data);
-typedef void (*MFreeBakeData)(void *bake_data);
+typedef void * (*MInitBakeData)(MultiresBakeRender *bkr, Image *ima);
+typedef void (*MApplyBakeData)(void *bake_data);
+typedef void (*MFreeBakeData)(void *bake_data);
typedef struct {
MVert *mvert;
@@ -157,25 +157,25 @@ typedef struct {
static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index)
{
- unsigned int indices[]= {data->mface[face_num].v1, data->mface[face_num].v2,
- data->mface[face_num].v3, data->mface[face_num].v4};
- const int smoothnormal= (data->mface[face_num].flag & ME_SMOOTH);
+ unsigned int indices[] = {data->mface[face_num].v1, data->mface[face_num].v2,
+ data->mface[face_num].v3, data->mface[face_num].v4};
+ const int smoothnormal = (data->mface[face_num].flag & ME_SMOOTH);
if (!smoothnormal) { /* flat */
if (data->precomputed_normals) {
- copy_v3_v3(norm, &data->precomputed_normals[3*face_num]);
+ copy_v3_v3(norm, &data->precomputed_normals[3 * face_num]);
}
else {
float nor[3];
float *p0, *p1, *p2;
- const int iGetNrVerts= data->mface[face_num].v4!=0 ? 4 : 3;
+ const int iGetNrVerts = data->mface[face_num].v4 != 0 ? 4 : 3;
- p0= data->mvert[indices[0]].co;
- p1= data->mvert[indices[1]].co;
- p2= data->mvert[indices[2]].co;
+ p0 = data->mvert[indices[0]].co;
+ p1 = data->mvert[indices[1]].co;
+ p2 = data->mvert[indices[2]].co;
- if (iGetNrVerts==4) {
- float *p3= data->mvert[indices[3]].co;
+ if (iGetNrVerts == 4) {
+ float *p3 = data->mvert[indices[3]].co;
normal_quad_v3(nor, p0, p1, p2, p3);
}
else {
@@ -186,7 +186,7 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
}
}
else {
- short *no= data->mvert[indices[vert_index]].no;
+ short *no = data->mvert[indices[vert_index]].no;
normal_short_to_float_v3(norm, no);
normalize_v3(norm);
@@ -198,15 +198,15 @@ static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResol
memset(bake_rast, 0, sizeof(MBakeRast));
bake_rast->texels = ibuf->userdata;
- bake_rast->w= ibuf->x;
- bake_rast->h= ibuf->y;
- bake_rast->data= data;
- bake_rast->flush_pixel= flush_pixel;
+ bake_rast->w = ibuf->x;
+ bake_rast->h = ibuf->y;
+ bake_rast->data = data;
+ bake_rast->flush_pixel = flush_pixel;
}
static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
{
- float st[2]= {(x+0.5f)/data->w, (y+0.5f)/data->h};
+ float st[2] = {(x + 0.5f) / data->w, (y + 0.5f) / data->h};
float *st0, *st1, *st2;
float *tang0, *tang1, *tang2;
float no0[3], no1[3], no2[3];
@@ -214,37 +214,37 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
float u, v, w, sign;
int r;
- const int i0= data->i0;
- const int i1= data->i1;
- const int i2= data->i2;
+ const int i0 = data->i0;
+ const int i1 = data->i1;
+ const int i2 = data->i2;
- st0= data->mtface[data->face_index].uv[i0];
- st1= data->mtface[data->face_index].uv[i1];
- st2= data->mtface[data->face_index].uv[i2];
+ st0 = data->mtface[data->face_index].uv[i0];
+ st1 = data->mtface[data->face_index].uv[i1];
+ st2 = data->mtface[data->face_index].uv[i2];
- tang0= data->pvtangent + data->face_index*16 + i0*4;
- tang1= data->pvtangent + data->face_index*16 + i1*4;
- tang2= data->pvtangent + data->face_index*16 + i2*4;
+ tang0 = data->pvtangent + data->face_index * 16 + i0 * 4;
+ tang1 = data->pvtangent + data->face_index * 16 + i1 * 4;
+ tang2 = data->pvtangent + data->face_index * 16 + i2 * 4;
- multiresbake_get_normal(data, no0, data->face_index, i0); /* can optimize these 3 into one call */
+ multiresbake_get_normal(data, no0, data->face_index, i0); /* can optimize these 3 into one call */
multiresbake_get_normal(data, no1, data->face_index, i1);
multiresbake_get_normal(data, no2, data->face_index, i2);
resolve_tri_uv(fUV, st, st0, st1, st2);
- u= fUV[0];
- v= fUV[1];
- w= 1-u-v;
+ u = fUV[0];
+ v = fUV[1];
+ w = 1 - u - v;
/* the sign is the same at all face vertices for any non degenerate face.
* Just in case we clamp the interpolated value though. */
- sign= (tang0[3]*u + tang1[3]*v + tang2[3]*w)<0 ? (-1.0f) : 1.0f;
+ sign = (tang0[3] * u + tang1[3] * v + tang2[3] * w) < 0 ? (-1.0f) : 1.0f;
/* this sequence of math is designed specifically as is with great care
* to be compatible with our shader. Please don't change without good reason. */
- for (r= 0; r<3; r++) {
- from_tang[0][r]= tang0[r]*u + tang1[r]*v + tang2[r]*w;
- from_tang[2][r]= no0[r]*u + no1[r]*v + no2[r]*w;
+ for (r = 0; r < 3; r++) {
+ from_tang[0][r] = tang0[r] * u + tang1[r] * v + tang2[r] * w;
+ from_tang[2][r] = no0[r] * u + no1[r] * v + no2[r] * w;
}
cross_v3_v3v3(from_tang[1], from_tang[2], from_tang[0]); /* B = sign * cross(N, T) */
@@ -258,13 +258,13 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int y)
{
- const int w= bake_rast->w;
- const int h= bake_rast->h;
+ const int w = bake_rast->w;
+ const int h = bake_rast->h;
- if (x>=0 && x<w && y>=0 && y<h) {
- if ((bake_rast->texels[y*w+x])==0) {
+ if (x >= 0 && x < w && y >= 0 && y < h) {
+ if ((bake_rast->texels[y * w + x]) == 0) {
flush_pixel(bake_rast->data, x, y);
- bake_rast->texels[y*w+x]= FILTER_MASK_USED;
+ bake_rast->texels[y * w + x] = FILTER_MASK_USED;
}
}
}
@@ -274,35 +274,35 @@ static void rasterize_half(const MBakeRast *bake_rast,
const float s0_l, const float t0_l, const float s1_l, const float t1_l,
const int y0_in, const int y1_in, const int is_mid_right)
{
- const int s_stable= fabsf(t1_s-t0_s)>FLT_EPSILON ? 1 : 0;
- const int l_stable= fabsf(t1_l-t0_l)>FLT_EPSILON ? 1 : 0;
- const int w= bake_rast->w;
- const int h= bake_rast->h;
+ const int s_stable = fabsf(t1_s - t0_s) > FLT_EPSILON ? 1 : 0;
+ const int l_stable = fabsf(t1_l - t0_l) > FLT_EPSILON ? 1 : 0;
+ const int w = bake_rast->w;
+ const int h = bake_rast->h;
int y, y0, y1;
- if (y1_in<=0 || y0_in>=h)
+ if (y1_in <= 0 || y0_in >= h)
return;
- y0= y0_in<0 ? 0 : y0_in;
- y1= y1_in>=h ? h : y1_in;
+ y0 = y0_in < 0 ? 0 : y0_in;
+ y1 = y1_in >= h ? h : y1_in;
- for (y= y0; y<y1; y++) {
+ for (y = y0; y < y1; y++) {
/*-b(x-x0) + a(y-y0) = 0 */
int iXl, iXr, x;
- float x_l= s_stable!=0 ? (s0_s + (((s1_s-s0_s)*(y-t0_s))/(t1_s-t0_s))) : s0_s;
- float x_r= l_stable!=0 ? (s0_l + (((s1_l-s0_l)*(y-t0_l))/(t1_l-t0_l))) : s0_l;
+ float x_l = s_stable != 0 ? (s0_s + (((s1_s - s0_s) * (y - t0_s)) / (t1_s - t0_s))) : s0_s;
+ float x_r = l_stable != 0 ? (s0_l + (((s1_l - s0_l) * (y - t0_l)) / (t1_l - t0_l))) : s0_l;
- if (is_mid_right!=0)
+ if (is_mid_right != 0)
SWAP(float, x_l, x_r);
- iXl= (int)ceilf(x_l);
- iXr= (int)ceilf(x_r);
+ iXl = (int)ceilf(x_l);
+ iXr = (int)ceilf(x_r);
- if (iXr>0 && iXl<w) {
- iXl= iXl<0?0:iXl;
- iXr= iXr>=w?w:iXr;
+ if (iXr > 0 && iXl < w) {
+ iXl = iXl < 0 ? 0 : iXl;
+ iXr = iXr >= w ? w : iXr;
- for (x= iXl; x<iXr; x++)
+ for (x = iXl; x < iXr; x++)
set_rast_triangle(bake_rast, x, y);
}
}
@@ -310,40 +310,40 @@ static void rasterize_half(const MBakeRast *bake_rast,
static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], const float st1_in[2], const float st2_in[2])
{
- const int w= bake_rast->w;
- const int h= bake_rast->h;
- float slo= st0_in[0]*w - 0.5f;
- float tlo= st0_in[1]*h - 0.5f;
- float smi= st1_in[0]*w - 0.5f;
- float tmi= st1_in[1]*h - 0.5f;
- float shi= st2_in[0]*w - 0.5f;
- float thi= st2_in[1]*h - 0.5f;
- int is_mid_right= 0, ylo, yhi, yhi_beg;
+ const int w = bake_rast->w;
+ const int h = bake_rast->h;
+ float slo = st0_in[0] * w - 0.5f;
+ float tlo = st0_in[1] * h - 0.5f;
+ float smi = st1_in[0] * w - 0.5f;
+ float tmi = st1_in[1] * h - 0.5f;
+ float shi = st2_in[0] * w - 0.5f;
+ float thi = st2_in[1] * h - 0.5f;
+ int is_mid_right = 0, ylo, yhi, yhi_beg;
/* skip degenerates */
- if ((slo==smi && tlo==tmi) || (slo==shi && tlo==thi) || (smi==shi && tmi==thi))
+ if ((slo == smi && tlo == tmi) || (slo == shi && tlo == thi) || (smi == shi && tmi == thi))
return;
/* sort by T */
- if (tlo>tmi && tlo>thi) {
+ if (tlo > tmi && tlo > thi) {
SWAP(float, shi, slo);
SWAP(float, thi, tlo);
}
- else if (tmi>thi) {
+ else if (tmi > thi) {
SWAP(float, shi, smi);
SWAP(float, thi, tmi);
}
- if (tlo>tmi) {
+ if (tlo > tmi) {
SWAP(float, slo, smi);
SWAP(float, tlo, tmi);
}
/* check if mid point is to the left or to the right of the lo-hi edge */
- is_mid_right= (-(shi-slo)*(tmi-thi) + (thi-tlo)*(smi-shi))>0 ? 1 : 0;
- ylo= (int) ceilf(tlo);
- yhi_beg= (int) ceilf(tmi);
- yhi= (int) ceilf(thi);
+ is_mid_right = (-(shi - slo) * (tmi - thi) + (thi - tlo) * (smi - shi)) > 0 ? 1 : 0;
+ ylo = (int) ceilf(tlo);
+ yhi_beg = (int) ceilf(tmi);
+ yhi = (int) ceilf(thi);
/*if (fTmi>ceilf(fTlo))*/
rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right);
@@ -360,69 +360,69 @@ static int multiresbake_test_break(MultiresBakeRender *bkr)
return G.afbreek;
}
-static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData passKnownData,
+static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, MPassKnownData passKnownData,
MInitBakeData initBakeData, MApplyBakeData applyBakeData, MFreeBakeData freeBakeData)
{
- DerivedMesh *dm= bkr->lores_dm;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- const int lvl= bkr->lvl;
- const int tot_face= dm->getNumTessFaces(dm);
- MVert *mvert= dm->getVertArray(dm);
- MFace *mface= dm->getTessFaceArray(dm);
- MTFace *mtface= dm->getTessFaceDataArray(dm, CD_MTFACE);
- float *pvtangent= NULL;
+ DerivedMesh *dm = bkr->lores_dm;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ const int lvl = bkr->lvl;
+ const int tot_face = dm->getNumTessFaces(dm);
+ MVert *mvert = dm->getVertArray(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ MTFace *mtface = dm->getTessFaceDataArray(dm, CD_MTFACE);
+ float *pvtangent = NULL;
if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
- pvtangent= DM_get_tessface_data_layer(dm, CD_TANGENT);
+ pvtangent = DM_get_tessface_data_layer(dm, CD_TANGENT);
if (tot_face > 0) { /* sanity check */
- int f= 0;
+ int f = 0;
MBakeRast bake_rast;
- MResolvePixelData data={NULL};
-
- data.mface= mface;
- data.mvert= mvert;
- data.mtface= mtface;
- data.pvtangent= pvtangent;
- data.precomputed_normals= dm->getTessFaceDataArray(dm, CD_NORMAL); /* don't strictly need this */
- data.w= ibuf->x;
- data.h= ibuf->y;
- data.lores_dm= dm;
- data.hires_dm= bkr->hires_dm;
- data.lvl= lvl;
- data.pass_data= passKnownData;
+ MResolvePixelData data = {NULL};
+
+ data.mface = mface;
+ data.mvert = mvert;
+ data.mtface = mtface;
+ data.pvtangent = pvtangent;
+ data.precomputed_normals = dm->getTessFaceDataArray(dm, CD_NORMAL); /* don't strictly need this */
+ data.w = ibuf->x;
+ data.h = ibuf->y;
+ data.lores_dm = dm;
+ data.hires_dm = bkr->hires_dm;
+ data.lvl = lvl;
+ data.pass_data = passKnownData;
if (initBakeData)
- data.bake_data= initBakeData(bkr, ima);
+ data.bake_data = initBakeData(bkr, ima);
init_bake_rast(&bake_rast, ibuf, &data, flush_pixel);
- for (f= 0; f<tot_face; f++) {
- MTFace *mtfate= &mtface[f];
+ for (f = 0; f < tot_face; f++) {
+ MTFace *mtfate = &mtface[f];
int verts[3][2], nr_tris, t;
if (multiresbake_test_break(bkr))
break;
- if (mtfate->tpage!=ima)
+ if (mtfate->tpage != ima)
continue;
- data.face_index= f;
+ data.face_index = f;
/* might support other forms of diagonal splits later on such as
* split by shortest diagonal.*/
- verts[0][0]=0;
- verts[1][0]=1;
- verts[2][0]=2;
+ verts[0][0] = 0;
+ verts[1][0] = 1;
+ verts[2][0] = 2;
- verts[0][1]=0;
- verts[1][1]=2;
- verts[2][1]=3;
+ verts[0][1] = 0;
+ verts[1][1] = 2;
+ verts[2][1] = 3;
- nr_tris= mface[f].v4!=0 ? 2 : 1;
- for (t= 0; t<nr_tris; t++) {
+ nr_tris = mface[f].v4 != 0 ? 2 : 1;
+ for (t = 0; t < nr_tris; t++) {
data.i0 = verts[0][t];
data.i1 = verts[1][t];
data.i2 = verts[2][t];
@@ -433,10 +433,10 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
bkr->baked_faces++;
if (bkr->do_update)
- *bkr->do_update= 1;
+ *bkr->do_update = 1;
if (bkr->progress)
- *bkr->progress= ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj;
+ *bkr->progress = ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj;
}
if (applyBakeData)
@@ -452,13 +452,13 @@ static void interp_bilinear_quad_data(float data[4][3], float u, float v, float
float vec[3];
copy_v3_v3(res, data[0]);
- mul_v3_fl(res, (1-u)*(1-v));
+ mul_v3_fl(res, (1 - u) * (1 - v));
copy_v3_v3(vec, data[1]);
- mul_v3_fl(vec, u*(1-v)); add_v3_v3(res, vec);
+ mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
copy_v3_v3(vec, data[2]);
- mul_v3_fl(vec, u*v); add_v3_v3(res, vec);
+ mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
copy_v3_v3(vec, data[3]);
- mul_v3_fl(vec, (1-u)*v); add_v3_v3(res, vec);
+ mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
}
static void interp_barycentric_tri_data(float data[3][3], float u, float v, float res[3])
@@ -470,7 +470,7 @@ static void interp_barycentric_tri_data(float data[3][3], float u, float v, floa
copy_v3_v3(vec, data[1]);
mul_v3_fl(vec, v); add_v3_v3(res, vec);
copy_v3_v3(vec, data[2]);
- mul_v3_fl(vec, 1.0f-u-v); add_v3_v3(res, vec);
+ mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
}
/* mode = 0: interpolate normals,
@@ -481,14 +481,14 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f
float u, v;
float data[4][3];
- x0= (int) crn_x;
- x1= x0>=(grid_size-1) ? (grid_size-1) : (x0+1);
+ x0 = (int) crn_x;
+ x1 = x0 >= (grid_size - 1) ? (grid_size - 1) : (x0 + 1);
- y0= (int) crn_y;
- y1= y0>=(grid_size-1) ? (grid_size-1) : (y0+1);
+ y0 = (int) crn_y;
+ y1 = y0 >= (grid_size - 1) ? (grid_size - 1) : (y0 + 1);
- u= crn_x-x0;
- v= crn_y-y0;
+ u = crn_x - x0;
+ v = crn_y - y0;
if (mode == 0) {
copy_v3_v3(data[0], grid[y0 * grid_size + x0].no);
@@ -516,30 +516,30 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
lodm->getTessFace(lodm, face_index, &mface);
- grid_size= hidm->getGridSize(hidm);
- grid_data= hidm->getGridData(hidm);
- grid_offset= hidm->getGridOffset(hidm);
+ grid_size = hidm->getGridSize(hidm);
+ grid_data = hidm->getGridData(hidm);
+ grid_offset = hidm->getGridOffset(hidm);
- face_side= (grid_size<<1)-1;
+ face_side = (grid_size << 1) - 1;
- if (lvl==0) {
- g_index= grid_offset[face_index];
- S= mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u*(face_side-1), v*(face_side-1), &crn_x, &crn_y);
+ if (lvl == 0) {
+ g_index = grid_offset[face_index];
+ S = mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u * (face_side - 1), v * (face_side - 1), &crn_x, &crn_y);
}
else {
- int side= (1 << (lvl-1)) + 1;
- int grid_index= origindex[face_index];
- int loc_offs= face_index % (1<<(2*lvl));
- int cell_index= loc_offs % ((side-1)*(side-1));
- int cell_side= grid_size / (side-1);
- int row= cell_index / (side-1);
- int col= cell_index % (side-1);
-
- S= face_index / (1<<(2*(lvl-1))) - grid_offset[grid_index];
- g_index= grid_offset[grid_index];
-
- crn_y= (row * cell_side) + u * cell_side;
- crn_x= (col * cell_side) + v * cell_side;
+ int side = (1 << (lvl - 1)) + 1;
+ int grid_index = origindex[face_index];
+ int loc_offs = face_index % (1 << (2 * lvl));
+ int cell_index = loc_offs % ((side - 1) * (side - 1));
+ int cell_side = grid_size / (side - 1);
+ int row = cell_index / (side - 1);
+ int col = cell_index % (side - 1);
+
+ S = face_index / (1 << (2 * (lvl - 1))) - grid_offset[grid_index];
+ g_index = grid_offset[grid_index];
+
+ crn_y = (row * cell_side) + u * cell_side;
+ crn_x = (col * cell_side) + v * cell_side;
}
CLAMP(crn_x, 0.0f, grid_size);
@@ -597,95 +597,95 @@ static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float
static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
{
MHeightBakeData *height_data;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- DerivedMesh *lodm= bkr->lores_dm;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ DerivedMesh *lodm = bkr->lores_dm;
- height_data= MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData");
+ height_data = MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData");
- height_data->ima= ima;
- height_data->heights= MEM_callocN(sizeof(float)*ibuf->x*ibuf->y, "MultiresBake heights");
- height_data->height_max= -FLT_MAX;
- height_data->height_min= FLT_MAX;
+ height_data->ima = ima;
+ height_data->heights = MEM_callocN(sizeof(float) * ibuf->x * ibuf->y, "MultiresBake heights");
+ height_data->height_max = -FLT_MAX;
+ height_data->height_min = FLT_MAX;
if (!bkr->use_lores_mesh) {
- SubsurfModifierData smd= {{NULL}};
- int ss_lvl= bkr->tot_lvl - bkr->lvl;
+ SubsurfModifierData smd = {{NULL}};
+ int ss_lvl = bkr->tot_lvl - bkr->lvl;
CLAMP(ss_lvl, 0, 6);
- smd.levels= smd.renderLevels= ss_lvl;
- smd.flags|= eSubsurfModifierFlag_SubsurfUv;
+ smd.levels = smd.renderLevels = ss_lvl;
+ smd.flags |= eSubsurfModifierFlag_SubsurfUv;
if (bkr->simple)
- smd.subdivType= ME_SIMPLE_SUBSURF;
+ smd.subdivType = ME_SIMPLE_SUBSURF;
- height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
+ height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
}
- height_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+ height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
- return (void*)height_data;
+ return (void *)height_data;
}
static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
{
MNormalBakeData *normal_data;
- DerivedMesh *lodm= bkr->lores_dm;
+ DerivedMesh *lodm = bkr->lores_dm;
- normal_data= MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
+ normal_data = MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
- normal_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+ normal_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
- return (void*)normal_data;
+ return (void *)normal_data;
}
static void free_normal_data(void *bake_data)
{
- MNormalBakeData *normal_data= (MNormalBakeData*)bake_data;
+ MNormalBakeData *normal_data = (MNormalBakeData *)bake_data;
MEM_freeN(normal_data);
}
static void apply_heights_data(void *bake_data)
{
- MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
- ImBuf *ibuf= BKE_image_get_ibuf(height_data->ima, NULL);
+ MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
+ ImBuf *ibuf = BKE_image_get_ibuf(height_data->ima, NULL);
int x, y, i;
- float height, *heights= height_data->heights;
- float min= height_data->height_min, max= height_data->height_max;
+ float height, *heights = height_data->heights;
+ float min = height_data->height_min, max = height_data->height_max;
- for (x= 0; x<ibuf->x; x++) {
- for (y =0; y<ibuf->y; y++) {
- i= ibuf->x*y + x;
+ for (x = 0; x < ibuf->x; x++) {
+ for (y = 0; y < ibuf->y; y++) {
+ i = ibuf->x * y + x;
- if (((char*)ibuf->userdata)[i] != FILTER_MASK_USED)
+ if (((char *)ibuf->userdata)[i] != FILTER_MASK_USED)
continue;
if (ibuf->rect_float) {
- float *rrgbf= ibuf->rect_float + i*4;
+ float *rrgbf = ibuf->rect_float + i * 4;
- if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
- else height= 0;
+ if (max - min > 1e-5f) height = (heights[i] - min) / (max - min);
+ else height = 0;
- rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
+ rrgbf[0] = rrgbf[1] = rrgbf[2] = height;
}
else {
- char *rrgb= (char*)ibuf->rect + i*4;
+ char *rrgb = (char *)ibuf->rect + i * 4;
- if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
- else height= 0;
+ if (max - min > 1e-5f) height = (heights[i] - min) / (max - min);
+ else height = 0;
- rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);
+ rrgb[0] = rrgb[1] = rrgb[2] = FTOCHAR(height);
}
}
}
- ibuf->userflags= IB_RECT_INVALID;
+ ibuf->userflags = IB_RECT_INVALID;
}
static void free_heights_data(void *bake_data)
{
- MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
+ MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
if (height_data->ssdm)
height_data->ssdm->release(height_data->ssdm);
@@ -704,23 +704,23 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
const int face_index, const int lvl, const float st[2],
float UNUSED(tangmat[3][3]), const int x, const int y)
{
- MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
+ MTFace *mtface = CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
MFace mface;
- Image *ima= mtface[face_index].tpage;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
+ Image *ima = mtface[face_index].tpage;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
float uv[2], *st0, *st1, *st2, *st3;
- int pixel= ibuf->x*y + x;
+ int pixel = ibuf->x * y + x;
float vec[3], p0[3], p1[3], n[3], len;
lores_dm->getTessFace(lores_dm, face_index, &mface);
- st0= mtface[face_index].uv[0];
- st1= mtface[face_index].uv[1];
- st2= mtface[face_index].uv[2];
+ st0 = mtface[face_index].uv[0];
+ st1 = mtface[face_index].uv[1];
+ st2 = mtface[face_index].uv[2];
if (mface.v4) {
- st3= mtface[face_index].uv[3];
+ st3 = mtface[face_index].uv[3];
resolve_quad_uv(uv, st, st0, st1, st2, st3);
}
else
@@ -748,21 +748,21 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
}
sub_v3_v3v3(vec, p1, p0);
- len= dot_v3v3(n, vec);
+ len = dot_v3v3(n, vec);
- height_data->heights[pixel]= len;
- if (len<height_data->height_min) height_data->height_min= len;
- if (len>height_data->height_max) height_data->height_max= len;
+ height_data->heights[pixel] = len;
+ if (len < height_data->height_min) height_data->height_min = len;
+ if (len > height_data->height_max) height_data->height_max = len;
if (ibuf->rect_float) {
- float *rrgbf= ibuf->rect_float + pixel*4;
- rrgbf[3]= 1.0f;
+ float *rrgbf = ibuf->rect_float + pixel * 4;
+ rrgbf[3] = 1.0f;
- ibuf->userflags= IB_RECT_INVALID;
+ ibuf->userflags = IB_RECT_INVALID;
}
else {
- char *rrgb= (char*)ibuf->rect + pixel*4;
- rrgb[3]= 255;
+ char *rrgb = (char *)ibuf->rect + pixel * 4;
+ rrgb[3] = 255;
}
}
@@ -775,23 +775,23 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
const int face_index, const int lvl, const float st[2],
float tangmat[3][3], const int x, const int y)
{
- MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
+ MTFace *mtface = CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
MFace mface;
- Image *ima= mtface[face_index].tpage;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- MNormalBakeData *normal_data= (MNormalBakeData*)bake_data;
+ Image *ima = mtface[face_index].tpage;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ MNormalBakeData *normal_data = (MNormalBakeData *)bake_data;
float uv[2], *st0, *st1, *st2, *st3;
- int pixel= ibuf->x*y + x;
- float n[3], vec[3], tmp[3]= {0.5, 0.5, 0.5};
+ int pixel = ibuf->x * y + x;
+ float n[3], vec[3], tmp[3] = {0.5, 0.5, 0.5};
lores_dm->getTessFace(lores_dm, face_index, &mface);
- st0= mtface[face_index].uv[0];
- st1= mtface[face_index].uv[1];
- st2= mtface[face_index].uv[2];
+ st0 = mtface[face_index].uv[0];
+ st1 = mtface[face_index].uv[1];
+ st2 = mtface[face_index].uv[2];
if (mface.v4) {
- st3= mtface[face_index].uv[3];
+ st3 = mtface[face_index].uv[3];
resolve_quad_uv(uv, st, st0, st1, st2, st3);
}
else
@@ -808,61 +808,61 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
add_v3_v3(vec, tmp);
if (ibuf->rect_float) {
- float *rrgbf= ibuf->rect_float + pixel*4;
- rrgbf[0]= vec[0];
- rrgbf[1]= vec[1];
- rrgbf[2]= vec[2];
- rrgbf[3]= 1.0f;
+ float *rrgbf = ibuf->rect_float + pixel * 4;
+ rrgbf[0] = vec[0];
+ rrgbf[1] = vec[1];
+ rrgbf[2] = vec[2];
+ rrgbf[3] = 1.0f;
- ibuf->userflags= IB_RECT_INVALID;
+ ibuf->userflags = IB_RECT_INVALID;
}
else {
- unsigned char *rrgb= (unsigned char *)ibuf->rect + pixel*4;
+ unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4;
rgb_float_to_uchar(rrgb, vec);
- rrgb[3]= 255;
+ rrgb[3] = 255;
}
}
static void count_images(MultiresBakeRender *bkr)
{
int a, totface;
- DerivedMesh *dm= bkr->lores_dm;
- MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE);
+ DerivedMesh *dm = bkr->lores_dm;
+ MTFace *mtface = CustomData_get_layer(&dm->faceData, CD_MTFACE);
- bkr->image.first= bkr->image.last= NULL;
- bkr->tot_image= 0;
+ bkr->image.first = bkr->image.last = NULL;
+ bkr->tot_image = 0;
- totface= dm->getNumTessFaces(dm);
+ totface = dm->getNumTessFaces(dm);
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
- for (a= 0; a<totface; a++) {
- Image *ima= mtface[a].tpage;
- if ((ima->id.flag&LIB_DOIT)==0) {
- LinkData *data= BLI_genericNodeN(ima);
+ for (a = 0; a < totface; a++) {
+ Image *ima = mtface[a].tpage;
+ if ((ima->id.flag & LIB_DOIT) == 0) {
+ LinkData *data = BLI_genericNodeN(ima);
BLI_addtail(&bkr->image, data);
bkr->tot_image++;
- ima->id.flag|= LIB_DOIT;
+ ima->id.flag |= LIB_DOIT;
}
}
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
}
static void bake_images(MultiresBakeRender *bkr)
{
LinkData *link;
- for (link= bkr->image.first; link; link= link->next) {
- Image *ima= (Image*)link->data;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ for (link = bkr->image.first; link; link = link->next) {
+ Image *ima = (Image *)link->data;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
- if (ibuf->x>0 && ibuf->y>0) {
- ibuf->userdata= MEM_callocN(ibuf->y*ibuf->x, "MultiresBake imbuf mask");
+ if (ibuf->x > 0 && ibuf->y > 0) {
+ ibuf->userdata = MEM_callocN(ibuf->y * ibuf->x, "MultiresBake imbuf mask");
- switch(bkr->mode) {
+ switch (bkr->mode) {
case RE_BAKE_NORMALS:
do_multires_bake(bkr, ima, apply_tangmat_callback, init_normal_data, NULL, free_normal_data);
break;
@@ -873,7 +873,7 @@ static void bake_images(MultiresBakeRender *bkr)
}
}
- ima->id.flag|= LIB_DOIT;
+ ima->id.flag |= LIB_DOIT;
}
}
@@ -881,28 +881,28 @@ static void finish_images(MultiresBakeRender *bkr)
{
LinkData *link;
- for (link= bkr->image.first; link; link= link->next) {
- Image *ima= (Image*)link->data;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ for (link = bkr->image.first; link; link = link->next) {
+ Image *ima = (Image *)link->data;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
- if (ibuf->x<=0 || ibuf->y<=0)
+ if (ibuf->x <= 0 || ibuf->y <= 0)
continue;
RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, bkr->bake_filter);
- ibuf->userflags|= IB_BITMAPDIRTY;
+ ibuf->userflags |= IB_BITMAPDIRTY;
if (ibuf->rect_float)
- ibuf->userflags|= IB_RECT_INVALID;
+ ibuf->userflags |= IB_RECT_INVALID;
if (ibuf->mipmap[0]) {
- ibuf->userflags|= IB_MIPMAP_INVALID;
+ ibuf->userflags |= IB_MIPMAP_INVALID;
imb_freemipmapImBuf(ibuf);
}
if (ibuf->userdata) {
MEM_freeN(ibuf->userdata);
- ibuf->userdata= NULL;
+ ibuf->userdata = NULL;
}
}
}
@@ -916,38 +916,38 @@ static void multiresbake_start(MultiresBakeRender *bkr)
static int multiresbake_check(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
Mesh *me;
MultiresModifierData *mmd;
- int ok= 1, a;
+ int ok = 1, a;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- ob= base->object;
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ ob = base->object;
if (ob->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Basking of multires data only works with active object which is a mesh");
- ok= 0;
+ ok = 0;
break;
}
- me= (Mesh*)ob->data;
- mmd= get_multires_modifier(scene, ob, 0);
+ me = (Mesh *)ob->data;
+ mmd = get_multires_modifier(scene, ob, 0);
/* Multi-resolution should be and be last in the stack */
if (ok && mmd) {
ModifierData *md;
- ok= mmd->totlvl>0;
+ ok = mmd->totlvl > 0;
- for (md = (ModifierData*)mmd->modifier.next; md && ok; md = md->next) {
+ for (md = (ModifierData *)mmd->modifier.next; md && ok; md = md->next) {
if (modifier_isEnabled(scene, md, eModifierMode_Realtime)) {
- ok= 0;
+ ok = 0;
}
}
}
- else ok= 0;
+ else ok = 0;
if (!ok) {
BKE_report(op->reports, RPT_ERROR, "Multires data baking requires multi-resolution object");
@@ -958,7 +958,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
if (!me->mtpoly) {
BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking");
- ok= 0;
+ ok = 0;
}
else {
a = me->totpoly;
@@ -968,22 +968,22 @@ static int multiresbake_check(bContext *C, wmOperator *op)
if (!ima) {
BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker");
- ok= 0;
+ ok = 0;
}
else {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
if (!ibuf) {
BKE_report(op->reports, RPT_ERROR, "Baking should happend to image with image buffer");
- ok= 0;
+ ok = 0;
}
else {
- if (ibuf->rect==NULL && ibuf->rect_float==NULL)
- ok= 0;
+ if (ibuf->rect == NULL && ibuf->rect_float == NULL)
+ ok = 0;
- if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
- ok= 0;
+ if (ibuf->rect_float && !(ibuf->channels == 0 || ibuf->channels == 4))
+ ok = 0;
if (!ok)
BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type");
@@ -1003,23 +1003,23 @@ static int multiresbake_check(bContext *C, wmOperator *op)
static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *lvl)
{
DerivedMesh *dm;
- MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
- Mesh *me= (Mesh*)ob->data;
+ MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
+ Mesh *me = (Mesh *)ob->data;
- *lvl= mmd->lvl;
+ *lvl = mmd->lvl;
- if (*lvl==0) {
- DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob);
- dm= CDDM_copy(tmp_dm);
+ if (*lvl == 0) {
+ DerivedMesh *tmp_dm = CDDM_from_mesh(me, ob);
+ dm = CDDM_copy(tmp_dm);
tmp_dm->release(tmp_dm);
}
else {
- MultiresModifierData tmp_mmd= *mmd;
- DerivedMesh *cddm= CDDM_from_mesh(me, ob);
+ MultiresModifierData tmp_mmd = *mmd;
+ DerivedMesh *cddm = CDDM_from_mesh(me, ob);
- tmp_mmd.lvl= *lvl;
- tmp_mmd.sculptlvl= *lvl;
- dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
+ tmp_mmd.lvl = *lvl;
+ tmp_mmd.sculptlvl = *lvl;
+ dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
cddm->release(cddm);
}
@@ -1028,18 +1028,18 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *lvl, int *simple)
{
- Mesh *me= (Mesh*)ob->data;
- MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
- MultiresModifierData tmp_mmd= *mmd;
- DerivedMesh *cddm= CDDM_from_mesh(me, ob);
+ Mesh *me = (Mesh *)ob->data;
+ MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
+ MultiresModifierData tmp_mmd = *mmd;
+ DerivedMesh *cddm = CDDM_from_mesh(me, ob);
DerivedMesh *dm;
- *lvl= mmd->totlvl;
- *simple= mmd->simple;
+ *lvl = mmd->totlvl;
+ *simple = mmd->simple;
- tmp_mmd.lvl= mmd->totlvl;
- tmp_mmd.sculptlvl= mmd->totlvl;
- dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
+ tmp_mmd.lvl = mmd->totlvl;
+ tmp_mmd.sculptlvl = mmd->totlvl;
+ dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
cddm->release(cddm);
return dm;
@@ -1048,67 +1048,67 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
static void clear_images(MTFace *mtface, int totface)
{
int a;
- const float vec_alpha[4]= {0.0f, 0.0f, 0.0f, 0.0f};
- const float vec_solid[4]= {0.0f, 0.0f, 0.0f, 1.0f};
+ const float vec_alpha[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ const float vec_solid[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
- for (a= 0; a<totface; a++) {
- Image *ima= mtface[a].tpage;
+ for (a = 0; a < totface; a++) {
+ Image *ima = mtface[a].tpage;
- if ((ima->id.flag&LIB_DOIT)==0) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ if ((ima->id.flag & LIB_DOIT) == 0) {
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
- ima->id.flag|= LIB_DOIT;
+ ima->id.flag |= LIB_DOIT;
}
}
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
}
static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
{
Object *ob;
- Scene *scene= CTX_data_scene(C);
- int objects_baked= 0;
+ Scene *scene = CTX_data_scene(C);
+ int objects_baked = 0;
if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
- if (scene->r.bake_flag&R_BAKE_CLEAR) { /* clear images */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ if (scene->r.bake_flag & R_BAKE_CLEAR) { /* clear images */
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
Mesh *me;
- ob= base->object;
- me= (Mesh*)ob->data;
+ ob = base->object;
+ me = (Mesh *)ob->data;
clear_images(me->mtface, me->totface);
}
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- MultiresBakeRender bkr= {0};
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ MultiresBakeRender bkr = {0};
- ob= base->object;
+ ob = base->object;
multires_force_update(ob);
/* copy data stored in job descriptor */
- bkr.bake_filter= scene->r.bake_filter;
- bkr.mode= scene->r.bake_mode;
- bkr.use_lores_mesh= scene->r.bake_flag&R_BAKE_LORES_MESH;
+ bkr.bake_filter = scene->r.bake_filter;
+ bkr.mode = scene->r.bake_mode;
+ bkr.use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
- bkr.lores_dm= multiresbake_create_loresdm(scene, ob, &bkr.lvl);
+ bkr.lores_dm = multiresbake_create_loresdm(scene, ob, &bkr.lvl);
if (!bkr.lores_dm)
continue;
- bkr.hires_dm= multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
+ bkr.hires_dm = multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
multiresbake_start(&bkr);
@@ -1130,20 +1130,20 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
/* Multiresbake adopted for job-system executing */
static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
/* backup scene settings, so their changing in UI would take no effect on baker */
- bkj->bake_filter= scene->r.bake_filter;
- bkj->mode= scene->r.bake_mode;
- bkj->use_lores_mesh= scene->r.bake_flag&R_BAKE_LORES_MESH;
- bkj->bake_clear= scene->r.bake_flag&R_BAKE_CLEAR;
+ bkj->bake_filter = scene->r.bake_filter;
+ bkj->mode = scene->r.bake_mode;
+ bkj->use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
+ bkj->bake_clear = scene->r.bake_flag & R_BAKE_CLEAR;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
MultiresBakerJobData *data;
DerivedMesh *lores_dm;
int lvl;
- ob= base->object;
+ ob = base->object;
multires_force_update(ob);
@@ -1151,7 +1151,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
if (!lores_dm)
continue;
- data= MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data");
+ data = MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data");
data->lores_dm = lores_dm;
data->lvl = lvl;
data->hires_dm = multiresbake_create_hiresdm(scene, ob, &data->tot_lvl, &data->simple);
@@ -1164,42 +1164,42 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
static void multiresbake_startjob(void *bkv, short *stop, short *do_update, float *progress)
{
MultiresBakerJobData *data;
- MultiresBakeJob *bkj= bkv;
- int baked_objects= 0, tot_obj;
+ MultiresBakeJob *bkj = bkv;
+ int baked_objects = 0, tot_obj;
- tot_obj= BLI_countlist(&bkj->data);
+ tot_obj = BLI_countlist(&bkj->data);
if (bkj->bake_clear) { /* clear images */
- for (data= bkj->data.first; data; data= data->next) {
- DerivedMesh *dm= data->lores_dm;
- MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE);
+ for (data = bkj->data.first; data; data = data->next) {
+ DerivedMesh *dm = data->lores_dm;
+ MTFace *mtface = CustomData_get_layer(&dm->faceData, CD_MTFACE);
clear_images(mtface, dm->getNumTessFaces(dm));
}
}
- for (data= bkj->data.first; data; data= data->next) {
- MultiresBakeRender bkr= {0};
+ for (data = bkj->data.first; data; data = data->next) {
+ MultiresBakeRender bkr = {0};
/* copy data stored in job descriptor */
- bkr.bake_filter= bkj->bake_filter;
- bkr.mode= bkj->mode;
- bkr.use_lores_mesh= bkj->use_lores_mesh;
+ bkr.bake_filter = bkj->bake_filter;
+ bkr.mode = bkj->mode;
+ bkr.use_lores_mesh = bkj->use_lores_mesh;
/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
- bkr.lores_dm= data->lores_dm;
- bkr.hires_dm= data->hires_dm;
- bkr.tot_lvl= data->tot_lvl;
- bkr.lvl= data->lvl;
- bkr.simple= data->simple;
+ bkr.lores_dm = data->lores_dm;
+ bkr.hires_dm = data->hires_dm;
+ bkr.tot_lvl = data->tot_lvl;
+ bkr.lvl = data->lvl;
+ bkr.simple = data->simple;
/* needed for proper progress bar */
- bkr.tot_obj= tot_obj;
- bkr.baked_objects= baked_objects;
+ bkr.tot_obj = tot_obj;
+ bkr.baked_objects = baked_objects;
- bkr.stop= stop;
- bkr.do_update= do_update;
- bkr.progress= progress;
+ bkr.stop = stop;
+ bkr.do_update = do_update;
+ bkr.progress = progress;
multiresbake_start(&bkr);
@@ -1211,16 +1211,16 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
static void multiresbake_freejob(void *bkv)
{
- MultiresBakeJob *bkj= bkv;
+ MultiresBakeJob *bkj = bkv;
MultiresBakerJobData *data, *next;
- data= bkj->data.first;
+ data = bkj->data.first;
while (data) {
- next= data->next;
+ next = data->next;
data->lores_dm->release(data->lores_dm);
data->hires_dm->release(data->hires_dm);
MEM_freeN(data);
- data= next;
+ data = next;
}
MEM_freeN(bkj);
@@ -1228,14 +1228,14 @@ static void multiresbake_freejob(void *bkv)
static int multiresbake_image_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
MultiresBakeJob *bkr;
wmJob *steve;
if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
- bkr= MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data");
+ bkr = MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data");
init_multiresbake_job(C, bkr);
if (!bkr->data.first) {
@@ -1244,12 +1244,12 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
}
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS);
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
WM_jobs_customdata(steve, bkr, multiresbake_freejob);
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL);
- G.afbreek= 0;
+ G.afbreek = 0;
WM_jobs_start(CTX_wm_manager(C), steve);
WM_cursor_wait(0);
@@ -1294,12 +1294,12 @@ typedef struct BakeRender {
/* use by exec and invoke */
static int test_bake_internal(bContext *C, ReportList *reports)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
- if ((scene->r.bake_flag & R_BAKE_TO_ACTIVE) && CTX_data_active_object(C)==NULL) {
+ if ((scene->r.bake_flag & R_BAKE_TO_ACTIVE) && CTX_data_active_object(C) == NULL) {
BKE_report(reports, RPT_ERROR, "No active object");
}
- else if (scene->r.bake_mode==RE_BAKE_AO && scene->world==NULL) {
+ else if (scene->r.bake_mode == RE_BAKE_AO && scene->world == NULL) {
BKE_report(reports, RPT_ERROR, "No world set up");
}
else {
@@ -1311,23 +1311,23 @@ static int test_bake_internal(bContext *C, ReportList *reports)
static void init_bake_internal(BakeRender *bkr, bContext *C)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* get editmode results */
ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
- bkr->sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */
- bkr->main= CTX_data_main(C);
- bkr->scene= scene;
- bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL;
- bkr->re= RE_NewRender("_Bake View_");
+ bkr->sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */
+ bkr->main = CTX_data_main(C);
+ bkr->scene = scene;
+ bkr->actob = (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL;
+ bkr->re = RE_NewRender("_Bake View_");
- if (scene->r.bake_mode==RE_BAKE_AO) {
+ if (scene->r.bake_mode == RE_BAKE_AO) {
/* If raytracing or AO is disabled, switch it on temporarily for baking. */
bkr->prev_wo_amb_occ = (scene->world->mode & WO_AMB_OCC) != 0;
scene->world->mode |= WO_AMB_OCC;
}
- if (scene->r.bake_mode==RE_BAKE_AO || bkr->actob) {
+ if (scene->r.bake_mode == RE_BAKE_AO || bkr->actob) {
bkr->prev_r_raytrace = (scene->r.mode & R_RAYTRACE) != 0;
scene->r.mode |= R_RAYTRACE;
}
@@ -1338,20 +1338,20 @@ static void finish_bake_internal(BakeRender *bkr)
RE_Database_Free(bkr->re);
/* restore raytrace and AO */
- if (bkr->scene->r.bake_mode==RE_BAKE_AO)
+ if (bkr->scene->r.bake_mode == RE_BAKE_AO)
if (bkr->prev_wo_amb_occ == 0)
bkr->scene->world->mode &= ~WO_AMB_OCC;
- if (bkr->scene->r.bake_mode==RE_BAKE_AO || bkr->actob)
+ if (bkr->scene->r.bake_mode == RE_BAKE_AO || bkr->actob)
if (bkr->prev_r_raytrace == 0)
bkr->scene->r.mode &= ~R_RAYTRACE;
- if (bkr->result==BAKE_RESULT_OK) {
+ if (bkr->result == BAKE_RESULT_OK) {
Image *ima;
/* force OpenGL reload and mipmap recalc */
- for (ima= G.main->image.first; ima; ima= ima->id.next) {
- if (ima->ok==IMA_OK_LOADED) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ for (ima = G.main->image.first; ima; ima = ima->id.next) {
+ if (ima->ok == IMA_OK_LOADED) {
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
if (ibuf) {
if (ibuf->userflags & IB_BITMAPDIRTY) {
GPU_free_image(ima);
@@ -1361,7 +1361,7 @@ static void finish_bake_internal(BakeRender *bkr)
/* freed when baking is done, but if its canceled we need to free here */
if (ibuf->userdata) {
MEM_freeN(ibuf->userdata);
- ibuf->userdata= NULL;
+ ibuf->userdata = NULL;
}
}
}
@@ -1371,52 +1371,52 @@ static void finish_bake_internal(BakeRender *bkr)
static void *do_bake_render(void *bake_v)
{
- BakeRender *bkr= bake_v;
+ BakeRender *bkr = bake_v;
- bkr->result= RE_bake_shade_all_selected(bkr->re, bkr->scene->r.bake_mode, bkr->actob, NULL, bkr->progress);
- bkr->ready= 1;
+ bkr->result = RE_bake_shade_all_selected(bkr->re, bkr->scene->r.bake_mode, bkr->actob, NULL, bkr->progress);
+ bkr->ready = 1;
return NULL;
}
static void bake_startjob(void *bkv, short *stop, short *do_update, float *progress)
{
- BakeRender *bkr= bkv;
- Scene *scene= bkr->scene;
- Main *bmain= bkr->main;
+ BakeRender *bkr = bkv;
+ Scene *scene = bkr->scene;
+ Main *bmain = bkr->main;
- bkr->stop= stop;
- bkr->do_update= do_update;
- bkr->progress= progress;
+ bkr->stop = stop;
+ bkr->do_update = do_update;
+ bkr->progress = progress;
RE_test_break_cb(bkr->re, NULL, thread_break);
- G.afbreek= 0; /* blender_test_break uses this global */
+ G.afbreek = 0; /* blender_test_break uses this global */
RE_Database_Baking(bkr->re, bmain, scene, scene->lay, scene->r.bake_mode, bkr->actob);
/* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */
- bkr->result= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress);
+ bkr->result = RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress);
}
static void bake_update(void *bkv)
{
- BakeRender *bkr= bkv;
+ BakeRender *bkr = bkv;
- if (bkr->sa && bkr->sa->spacetype==SPACE_IMAGE) { /* in case the user changed while baking */
- SpaceImage *sima= bkr->sa->spacedata.first;
+ if (bkr->sa && bkr->sa->spacetype == SPACE_IMAGE) { /* in case the user changed while baking */
+ SpaceImage *sima = bkr->sa->spacedata.first;
if (sima)
- sima->image= RE_bake_shade_get_image();
+ sima->image = RE_bake_shade_get_image();
}
}
static void bake_freejob(void *bkv)
{
- BakeRender *bkr= bkv;
+ BakeRender *bkr = bkv;
finish_bake_internal(bkr);
- if (bkr->result==BAKE_RESULT_NO_OBJECTS)
+ if (bkr->result == BAKE_RESULT_NO_OBJECTS)
BKE_report(bkr->reports, RPT_ERROR, "No objects or images found to bake to");
- else if (bkr->result==BAKE_RESULT_FEEDBACK_LOOP)
+ else if (bkr->result == BAKE_RESULT_FEEDBACK_LOOP)
BKE_report(bkr->reports, RPT_WARNING, "Feedback loop detected");
MEM_freeN(bkr);
@@ -1427,8 +1427,8 @@ static void bake_freejob(void *bkv)
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)))
- return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
/* running render */
switch (event->type) {
@@ -1441,7 +1441,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEven
static int is_multires_bake(Scene *scene)
{
- if ( ELEM(scene->r.bake_mode, RE_BAKE_NORMALS, RE_BAKE_DISPLACEMENT))
+ if (ELEM(scene->r.bake_mode, RE_BAKE_NORMALS, RE_BAKE_DISPLACEMENT))
return scene->r.bake_flag & R_BAKE_MULTIRES;
return 0;
@@ -1449,34 +1449,34 @@ static int is_multires_bake(Scene *scene)
static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event))
{
- Scene *scene= CTX_data_scene(C);
- int result= OPERATOR_CANCELLED;
+ Scene *scene = CTX_data_scene(C);
+ int result = OPERATOR_CANCELLED;
if (is_multires_bake(scene)) {
- result= multiresbake_image_exec(C, op);
+ result = multiresbake_image_exec(C, op);
}
else {
/* only one render job at a time */
if (WM_jobs_test(CTX_wm_manager(C), scene))
return OPERATOR_CANCELLED;
- if (test_bake_internal(C, op->reports)==0) {
+ if (test_bake_internal(C, op->reports) == 0) {
return OPERATOR_CANCELLED;
}
else {
- BakeRender *bkr= MEM_callocN(sizeof(BakeRender), "render bake");
+ BakeRender *bkr = MEM_callocN(sizeof(BakeRender), "render bake");
wmJob *steve;
init_bake_internal(bkr, C);
- bkr->reports= op->reports;
+ bkr->reports = op->reports;
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS);
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
WM_jobs_customdata(steve, bkr, bake_freejob);
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
- G.afbreek= 0;
+ G.afbreek = 0;
G.rendering = 1;
WM_jobs_start(CTX_wm_manager(C), steve);
@@ -1487,10 +1487,10 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
WM_event_add_modal_handler(C, op);
}
- result= OPERATOR_RUNNING_MODAL;
+ result = OPERATOR_RUNNING_MODAL;
}
- WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
return result;
}
@@ -1498,35 +1498,35 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
static int bake_image_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- int result= OPERATOR_CANCELLED;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int result = OPERATOR_CANCELLED;
if (is_multires_bake(scene)) {
- result= multiresbake_image_exec_locked(C, op);
+ result = multiresbake_image_exec_locked(C, op);
}
else {
- if (test_bake_internal(C, op->reports)==0) {
+ if (test_bake_internal(C, op->reports) == 0) {
return OPERATOR_CANCELLED;
}
else {
ListBase threads;
- BakeRender bkr= {NULL};
+ BakeRender bkr = {NULL};
init_bake_internal(&bkr, C);
- bkr.reports= op->reports;
+ bkr.reports = op->reports;
RE_test_break_cb(bkr.re, NULL, thread_break);
- G.afbreek= 0; /* blender_test_break uses this global */
+ G.afbreek = 0; /* blender_test_break uses this global */
- RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL);
+ RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL);
/* baking itself is threaded, cannot use test_break in threads */
BLI_init_threads(&threads, do_bake_render, 1);
- bkr.ready= 0;
+ bkr.ready = 0;
BLI_insert_thread(&threads, &bkr);
- while (bkr.ready==0) {
+ while (bkr.ready == 0) {
PIL_sleep_ms(50);
if (bkr.ready)
break;
@@ -1537,18 +1537,18 @@ static int bake_image_exec(bContext *C, wmOperator *op)
}
BLI_end_threads(&threads);
- if (bkr.result==BAKE_RESULT_NO_OBJECTS)
+ if (bkr.result == BAKE_RESULT_NO_OBJECTS)
BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to");
- else if (bkr.result==BAKE_RESULT_FEEDBACK_LOOP)
+ else if (bkr.result == BAKE_RESULT_FEEDBACK_LOOP)
BKE_report(op->reports, RPT_ERROR, "Feedback loop detected");
finish_bake_internal(&bkr);
- result= OPERATOR_FINISHED;
+ result = OPERATOR_FINISHED;
}
}
- WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
return result;
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index ec3567454df..a865b1d015d 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -81,7 +81,7 @@
/* -------------- Get Active Constraint Data ---------------------- */
/* if object in posemode, active bone constraints, else object constraints */
-ListBase *get_active_constraints (Object *ob)
+ListBase *get_active_constraints(Object *ob)
{
if (ob == NULL)
return NULL;
@@ -100,10 +100,10 @@ ListBase *get_active_constraints (Object *ob)
}
/* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */
-ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_r)
+ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **pchan_r)
{
if (pchan_r)
- *pchan_r= NULL;
+ *pchan_r = NULL;
if (ELEM(NULL, ob, con))
return NULL;
@@ -120,11 +120,11 @@ ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_
/* try each bone in order
* NOTE: it's not possible to directly look up the active bone yet, so this will have to do
*/
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((BLI_findindex(&pchan->constraints, con) != -1)) {
if (pchan_r)
- *pchan_r= pchan;
+ *pchan_r = pchan;
return &pchan->constraints;
}
@@ -136,7 +136,7 @@ ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_
}
/* single constraint */
-bConstraint *get_active_constraint (Object *ob)
+bConstraint *get_active_constraint(Object *ob)
{
return constraints_get_active(get_active_constraints(ob));
}
@@ -146,25 +146,25 @@ bConstraint *get_active_constraint (Object *ob)
/* ------------- PyConstraints ------------------ */
/* this callback sets the text-file to be used for selected menu item */
-static void validate_pyconstraint_cb (void *arg1, void *arg2)
+static void validate_pyconstraint_cb(void *arg1, void *arg2)
{
bPythonConstraint *data = arg1;
- Text *text= NULL;
+ Text *text = NULL;
int index = *((int *)arg2);
int i;
/* exception for no script */
if (index) {
/* innovative use of a for...loop to search */
- for (text=G.main->text.first, i=1; text && index!=i; i++, text=text->id.next);
+ for (text = G.main->text.first, i = 1; text && index != i; i++, text = text->id.next) ;
}
data->text = text;
}
/* this returns a string for the list of usable pyconstraint script names */
-static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
+static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex)
{
- DynStr *pupds= BLI_dynstr_new();
+ DynStr *pupds = BLI_dynstr_new();
Text *text;
char *str;
char buf[64];
@@ -176,16 +176,16 @@ static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
/* init active-index first */
if (con_text == NULL)
- *pyconindex= 0;
+ *pyconindex = 0;
/* loop through markers, adding them */
- for (text=G.main->text.first, i=1; text; i++, text=text->id.next) {
+ for (text = G.main->text.first, i = 1; text; i++, text = text->id.next) {
/* this is important to ensure that right script is shown as active */
if (text == con_text) *pyconindex = i;
/* only include valid pyconstraint scripts */
if (BPY_is_pyconstraint(text)) {
- BLI_dynstr_append(pupds, text->id.name+2);
+ BLI_dynstr_append(pupds, text->id.name + 2);
sprintf(buf, "%%x%d", i);
BLI_dynstr_append(pupds, buf);
@@ -196,7 +196,7 @@ static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
}
/* convert to normal MEM_malloc'd string */
- str= BLI_dynstr_get_cstring(pupds);
+ str = BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
return str;
@@ -205,14 +205,14 @@ static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
#if 0 // UNUSED, until pyconstraints are added back.
/* this callback gets called when the 'refresh' button of a pyconstraint gets pressed */
-static void update_pyconstraint_cb (void *arg1, void *arg2)
+static void update_pyconstraint_cb(void *arg1, void *arg2)
{
#ifndef WITH_PYTHON
(void)arg1; /* unused */
(void)arg2; /* unused */
#else
- Object *owner= (Object *)arg1;
- bConstraint *con= (bConstraint *)arg2;
+ Object *owner = (Object *)arg1;
+ bConstraint *con = (bConstraint *)arg2;
if (owner && con)
BPY_pyconstraint_update(owner, con);
#endif
@@ -220,30 +220,30 @@ static void update_pyconstraint_cb (void *arg1, void *arg2)
#endif // UNUSED
/* helper function for add_constriant - sets the last target for the active constraint */
-static void set_constraint_nth_target (bConstraint *con, Object *target, const char subtarget[], int index)
+static void set_constraint_nth_target(bConstraint *con, Object *target, const char subtarget[], int index)
{
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
int num_targets, i;
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
- num_targets= BLI_countlist(&targets);
+ num_targets = BLI_countlist(&targets);
if (index < 0) {
if (abs(index) < num_targets)
- index= num_targets - abs(index);
+ index = num_targets - abs(index);
else
- index= num_targets - 1;
+ index = num_targets - 1;
}
else if (index >= num_targets) {
- index= num_targets - 1;
+ index = num_targets - 1;
}
- for (ct=targets.first, i=0; ct; ct= ct->next, i++) {
+ for (ct = targets.first, i = 0; ct; ct = ct->next, i++) {
if (i == index) {
- ct->tar= target;
+ ct->tar = target;
BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget));
break;
}
@@ -259,13 +259,13 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c
/* checks validity of object pointers, and NULLs,
* if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag.
*/
-static void test_constraints (Object *owner, bPoseChannel *pchan)
+static void test_constraints(Object *owner, bPoseChannel *pchan)
{
bConstraint *curcon;
- ListBase *conlist= NULL;
+ ListBase *conlist = NULL;
int type;
- if (owner==NULL) return;
+ if (owner == NULL) return;
/* Check parents */
if (pchan) {
@@ -293,8 +293,8 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
/* Check all constraints - is constraint valid? */
if (conlist) {
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(curcon);
+ for (curcon = conlist->first; curcon; curcon = curcon->next) {
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(curcon);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
@@ -339,7 +339,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
bPivotConstraint *data = curcon->data;
/* target doesn't have to exist, but if it is non-null, it must exist! */
- if (data->tar && exist_object(data->tar)==0) {
+ if (data->tar && exist_object(data->tar) == 0) {
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
@@ -363,26 +363,26 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
bFollowPathConstraint *data = curcon->data;
/* don't allow track/up axes to be the same */
- if (data->upflag==data->trackflag)
+ if (data->upflag == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
- if (data->upflag+3==data->trackflag)
+ if (data->upflag + 3 == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
bTrackToConstraint *data = curcon->data;
/* don't allow track/up axes to be the same */
- if (data->reserved2==data->reserved1)
+ if (data->reserved2 == data->reserved1)
curcon->flag |= CONSTRAINT_DISABLE;
- if (data->reserved2+3==data->reserved1)
+ if (data->reserved2 + 3 == data->reserved1)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_LOCKTRACK) {
bLockTrackConstraint *data = curcon->data;
- if (data->lockflag==data->trackflag)
+ if (data->lockflag == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
- if (data->lockflag+3==data->trackflag)
+ if (data->lockflag + 3 == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_SPLINEIK) {
@@ -391,7 +391,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
/* if the number of points does not match the amount required by the chain length,
* free the points array and request a rebind...
*/
- if ((data->points == NULL) || (data->numpoints != data->chainlen+1)) {
+ if ((data->points == NULL) || (data->numpoints != data->chainlen + 1)) {
/* free the points array */
if (data->points) {
MEM_freeN(data->points);
@@ -405,15 +405,15 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
else if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
bFollowTrackConstraint *data = curcon->data;
- if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0) {
+ if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0) {
if (data->clip != NULL && data->track[0]) {
- MovieTracking *tracking= &data->clip->tracking;
+ MovieTracking *tracking = &data->clip->tracking;
MovieTrackingObject *tracking_object;
if (data->object[0])
- tracking_object= BKE_tracking_named_object(tracking, data->object);
+ tracking_object = BKE_tracking_named_object(tracking, data->object);
else
- tracking_object= BKE_tracking_get_camera_object(tracking);
+ tracking_object = BKE_tracking_get_camera_object(tracking);
if (!tracking_object) {
curcon->flag |= CONSTRAINT_DISABLE;
@@ -429,13 +429,13 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) {
bCameraSolverConstraint *data = curcon->data;
- if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
+ if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data = curcon->data;
- if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
+ if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL)
curcon->flag |= CONSTRAINT_DISABLE;
}
@@ -444,7 +444,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
cti->get_constraint_targets(curcon, &targets);
/* disable and clear constraints targets that are incorrect */
- for (ct= targets.first; ct; ct= ct->next) {
+ for (ct = targets.first; ct; ct = ct->next) {
/* general validity checks (for those constraints that need this) */
if (exist_object(ct->tar) == 0) {
/* object doesn't exist, but constraint requires target */
@@ -475,11 +475,11 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
if (ELEM3(curcon->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK)) {
if (ct->tar) {
if (ct->tar->type != OB_CURVE) {
- ct->tar= NULL;
+ ct->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
else {
- Curve *cu= ct->tar->data;
+ Curve *cu = ct->tar->data;
/* auto-set 'Path' setting on curve so this works */
cu->flag |= CU_PATH;
@@ -496,15 +496,15 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
}
}
-void object_test_constraints (Object *owner)
+void object_test_constraints(Object *owner)
{
if (owner->constraints.first)
test_constraints(owner, NULL);
- if (owner->type==OB_ARMATURE && owner->pose) {
+ if (owner->type == OB_ARMATURE && owner->pose) {
bPoseChannel *pchan;
- for (pchan= owner->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = owner->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->constraints.first)
test_constraints(owner, pchan);
}
@@ -514,8 +514,8 @@ void object_test_constraints (Object *owner)
/************************ generic functions for operators using constraint names and data context *********************/
-#define EDIT_CONSTRAINT_OWNER_OBJECT 0
-#define EDIT_CONSTRAINT_OWNER_BONE 1
+#define EDIT_CONSTRAINT_OWNER_OBJECT 0
+#define EDIT_CONSTRAINT_OWNER_BONE 1
static EnumPropertyItem constraint_owner_items[] = {
{EDIT_CONSTRAINT_OWNER_OBJECT, "OBJECT", 0, "Object", "Edit a constraint on the active object"},
@@ -525,11 +525,11 @@ static EnumPropertyItem constraint_owner_items[] = {
static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", rna_type);
- Object *ob= (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type);
+ Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
if (!ob || ob->id.lib) return 0;
- if (ptr.id.data && ((ID*)ptr.id.data)->lib) return 0;
+ if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0;
return 1;
}
@@ -547,8 +547,8 @@ static void edit_constraint_properties(wmOperatorType *ot)
static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
- Object *ob= (ptr.id.data)?ptr.id.data:ED_object_active_context(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
+ Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
bConstraint *con;
ListBase *list;
@@ -577,7 +577,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
char constraint_name[MAX_NAME];
int owner = RNA_enum_get(op->ptr, "owner");
bConstraint *con;
- ListBase *list=NULL;
+ ListBase *list = NULL;
RNA_string_get(op->ptr, "constraint", constraint_name);
@@ -585,7 +585,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
list = &ob->constraints;
}
else if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
- bPoseChannel *pchan= get_active_posechannel(ob);
+ bPoseChannel *pchan = get_active_posechannel(ob);
if (pchan)
list = &pchan->constraints;
else {
@@ -615,11 +615,11 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
/* ---------- Distance-Dependent Constraints ---------- */
/* StretchTo, Limit Distance */
-static int stretchto_reset_exec (bContext *C, wmOperator *op)
+static int stretchto_reset_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO);
- bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL;
+ bStretchToConstraint *data = (con) ? (bStretchToConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL)
@@ -629,7 +629,7 @@ static int stretchto_reset_exec (bContext *C, wmOperator *op)
data->orglength = 0.0f;
ED_object_constraint_update(ob);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -641,7 +641,7 @@ static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
+void CONSTRAINT_OT_stretchto_reset(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Reset Original Length";
@@ -653,16 +653,16 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
-static int limitdistance_reset_exec (bContext *C, wmOperator *op)
+static int limitdistance_reset_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT);
- bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL;
+ bDistLimitConstraint *data = (con) ? (bDistLimitConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL)
@@ -672,7 +672,7 @@ static int limitdistance_reset_exec (bContext *C, wmOperator *op)
data->dist = 0.0f;
ED_object_constraint_update(ob);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -684,7 +684,7 @@ static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
+void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Reset Distance";
@@ -696,16 +696,16 @@ void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
/* ------------- Child-Of Constraint ------------------ */
-static void child_get_inverse_matrix (Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
+static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
{
bConstraint *lastcon = NULL;
- bPoseChannel *pchan= NULL;
+ bPoseChannel *pchan = NULL;
/* nullify inverse matrix first */
unit_m4(invmat);
@@ -713,13 +713,13 @@ static void child_get_inverse_matrix (Scene *scene, Object *ob, bConstraint *con
/* try to find a pose channel - assume that this is the constraint owner */
// TODO: get from context instead?
if (ob && ob->pose)
- pchan= get_active_posechannel(ob);
+ pchan = get_active_posechannel(ob);
/* calculate/set inverse matrix:
- * We just calculate all transform-stack eval up to but not including this constraint.
- * This is because inverse should just inverse correct for just the constraint's influence
- * when it gets applied; that is, at the time of application, we don't know anything about
- * what follows.
+ * We just calculate all transform-stack eval up to but not including this constraint.
+ * This is because inverse should just inverse correct for just the constraint's influence
+ * when it gets applied; that is, at the time of application, we don't know anything about
+ * what follows.
*/
if (pchan) {
float imat[4][4], tmat[4][4];
@@ -781,23 +781,23 @@ static void child_get_inverse_matrix (Scene *scene, Object *ob, bConstraint *con
}
/* ChildOf Constraint - set inverse callback */
-static int childof_set_inverse_exec (bContext *C, wmOperator *op)
+static int childof_set_inverse_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
- bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
+ bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
- printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob)? ob->id.name+2 : "<None>");
+ printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>");
BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse");
return OPERATOR_CANCELLED;
}
child_get_inverse_matrix(scene, ob, con, data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -810,7 +810,7 @@ static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Inverse";
@@ -822,18 +822,18 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
/* ChildOf Constraint - clear inverse callback */
-static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
+static int childof_clear_inverse_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
- bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
+ bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
- if (data==NULL) {
+ if (data == NULL) {
BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
return OPERATOR_CANCELLED;
}
@@ -841,7 +841,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
/* simply clear the matrix */
unit_m4(data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -854,7 +854,7 @@ static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UN
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_childof_clear_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Inverse";
@@ -866,29 +866,29 @@ void CONSTRAINT_OT_childof_clear_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
/* ------------- Object Solver Constraint ------------------ */
-static int objectsolver_set_inverse_exec (bContext *C, wmOperator *op)
+static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
- bObjectSolverConstraint *data= (con) ? (bObjectSolverConstraint *)con->data : NULL;
+ bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
- printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob)? ob->id.name+2 : "<None>");
+ printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>");
BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse");
return OPERATOR_CANCELLED;
}
child_get_inverse_matrix(scene, ob, con, data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -901,7 +901,7 @@ static int objectsolver_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_objectsolver_set_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_objectsolver_set_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Inverse";
@@ -913,17 +913,17 @@ void CONSTRAINT_OT_objectsolver_set_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
-static int objectsolver_clear_inverse_exec (bContext *C, wmOperator *op)
+static int objectsolver_clear_inverse_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
- bObjectSolverConstraint *data= (con) ? (bObjectSolverConstraint *)con->data : NULL;
+ bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
- if (data==NULL) {
+ if (data == NULL) {
BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
return OPERATOR_CANCELLED;
}
@@ -931,7 +931,7 @@ static int objectsolver_clear_inverse_exec (bContext *C, wmOperator *op)
/* simply clear the matrix */
unit_m4(data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -944,7 +944,7 @@ static int objectsolver_clear_inverse_invoke(bContext *C, wmOperator *op, wmEven
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_objectsolver_clear_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_objectsolver_clear_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Inverse";
@@ -956,7 +956,7 @@ void CONSTRAINT_OT_objectsolver_clear_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -981,7 +981,7 @@ void ED_object_constraint_update(Object *ob)
object_test_constraints(ob);
- if (ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+ if (ob->type == OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
else DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
@@ -989,23 +989,23 @@ void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *o
{
ED_object_constraint_update(ob);
- if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
+ if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
DAG_scene_sort(bmain, scene);
}
static int constraint_poll(bContext *C)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
return (ptr.id.data && ptr.data);
}
-static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(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;
- bConstraint *con= ptr.data;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
+ Object *ob = ptr.id.data;
+ bConstraint *con = ptr.data;
ListBase *lb = get_constraint_lb(ob, con, NULL);
- const short is_ik= ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
+ const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
/* free the constraint */
if (remove_constraint(lb, con)) {
@@ -1020,7 +1020,7 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
}
/* notifiers */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
return OPERATOR_FINISHED;
}
@@ -1030,7 +1030,7 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
}
}
-void CONSTRAINT_OT_delete (wmOperatorType *ot)
+void CONSTRAINT_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Constraint";
@@ -1042,23 +1042,23 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot)
ot->poll = constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int constraint_move_down_exec (bContext *C, wmOperator *op)
+static int constraint_move_down_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->next) {
- ListBase *conlist= get_constraint_lb(ob, con, NULL);
- bConstraint *nextCon= con->next;
+ ListBase *conlist = get_constraint_lb(ob, con, NULL);
+ bConstraint *nextCon = con->next;
/* insert the nominated constraint after the one that used to be after it */
BLI_remlink(conlist, con);
BLI_insertlinkafter(conlist, nextCon, con);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -1075,7 +1075,7 @@ static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNU
}
-void CONSTRAINT_OT_move_down (wmOperatorType *ot)
+void CONSTRAINT_OT_move_down(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Constraint Down";
@@ -1088,25 +1088,25 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
-static int constraint_move_up_exec (bContext *C, wmOperator *op)
+static int constraint_move_up_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->prev) {
- ListBase *conlist= get_constraint_lb(ob, con, NULL);
- bConstraint *prevCon= con->prev;
+ ListBase *conlist = get_constraint_lb(ob, con, NULL);
+ bConstraint *prevCon = con->prev;
/* insert the nominated constraint before the one that used to be before it */
BLI_remlink(conlist, con);
BLI_insertlinkbefore(conlist, prevCon, con);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -1122,7 +1122,7 @@ static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_move_up (wmOperatorType *ot)
+void CONSTRAINT_OT_move_up(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Constraint Up";
@@ -1135,7 +1135,7 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -1145,26 +1145,25 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= object_pose_armature_get(CTX_data_active_object(C));
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
/* free constraints for all selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
free_constraints(&pchan->constraints);
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_SPLINEIK|PCHAN_HAS_CONST);
+ pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_SPLINEIK | PCHAN_HAS_CONST);
}
CTX_DATA_END;
/* force depsgraph to get recalculated since relationships removed */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
/* note, calling BIK_clear_data() isn't needed here */
/* do updates */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -1184,22 +1183,21 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
/* do freeing */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
free_constraints(&ob->constraints);
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
/* force depsgraph to get recalculated since relationships removed */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
/* do updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -1220,7 +1218,7 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot)
static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bPoseChannel *pchan = CTX_data_active_pose_bone(C);
@@ -1231,8 +1229,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
}
/* copy all constraints from active posebone to all selected posebones */
- CTX_DATA_BEGIN(C, bPoseChannel*, chan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, chan, selected_pose_bones) {
/* if we're not handling the object we're copying from, copy all constraints over */
if (pchan != chan) {
copy_constraints(&chan->constraints, &pchan->constraints, TRUE);
@@ -1243,9 +1240,9 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects/bones */
+ DAG_scene_sort(bmain, scene); /* sort order of objects/bones */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -1262,18 +1259,17 @@ void POSE_OT_constraints_copy(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *obact = ED_object_active_context(C);
/* copy all constraints from active object to all selected objects */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
/* if we're not handling the object we're copying from, copy all constraints over */
if (obact != ob) {
copy_constraints(&ob->constraints, &obact->constraints, TRUE);
@@ -1283,10 +1279,10 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, NULL);
return OPERATOR_FINISHED;
}
@@ -1303,7 +1299,7 @@ void OBJECT_OT_constraints_copy(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ add constraint operators *********************/
@@ -1311,25 +1307,25 @@ void OBJECT_OT_constraints_copy(wmOperatorType *ot)
/* get the Object and/or PoseChannel to use as target */
static short get_new_constraint_target(bContext *C, int con_type, Object **tar_ob, bPoseChannel **tar_pchan, short add)
{
- Object *obact= ED_object_active_context(C);
- bPoseChannel *pchanact= get_active_posechannel(obact);
- short only_curve= 0, only_mesh= 0, only_ob= 0;
- short found= 0;
+ Object *obact = ED_object_active_context(C);
+ bPoseChannel *pchanact = get_active_posechannel(obact);
+ short only_curve = 0, only_mesh = 0, only_ob = 0;
+ short found = 0;
/* clear tar_ob and tar_pchan fields before use
* - assume for now that both always exist...
*/
- *tar_ob= NULL;
- *tar_pchan= NULL;
+ *tar_ob = NULL;
+ *tar_pchan = NULL;
/* check if constraint type doesn't requires a target
* - if so, no need to get any targets
*/
switch (con_type) {
/* no-target constraints --------------------------- */
- /* null constraint - shouldn't even be added! */
+ /* null constraint - shouldn't even be added! */
case CONSTRAINT_TYPE_NULL:
- /* limit constraints - no targets needed */
+ /* limit constraints - no targets needed */
case CONSTRAINT_TYPE_LOCLIMIT:
case CONSTRAINT_TYPE_ROTLIMIT:
case CONSTRAINT_TYPE_SIZELIMIT:
@@ -1338,38 +1334,37 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* restricted target-type constraints -------------- */
/* NOTE: for these, we cannot try to add a target object if no valid ones are found, since that doesn't work */
- /* curve-based constraints - set the only_curve and only_ob flags */
+ /* curve-based constraints - set the only_curve and only_ob flags */
case CONSTRAINT_TYPE_CLAMPTO:
case CONSTRAINT_TYPE_FOLLOWPATH:
case CONSTRAINT_TYPE_SPLINEIK:
- only_curve= 1;
- only_ob= 1;
- add= 0;
+ only_curve = 1;
+ only_ob = 1;
+ add = 0;
break;
- /* mesh only? */
+ /* mesh only? */
case CONSTRAINT_TYPE_SHRINKWRAP:
- only_mesh= 1;
- only_ob= 1;
- add= 0;
+ only_mesh = 1;
+ only_ob = 1;
+ add = 0;
break;
- /* object only - add here is ok? */
+ /* object only - add here is ok? */
case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- only_ob= 1;
+ only_ob = 1;
break;
}
/* if the active Object is Armature, and we can search for bones, do so... */
if ((obact->type == OB_ARMATURE) && (only_ob == 0)) {
/* search in list of selected Pose-Channels for target */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
/* just use the first one that we encounter, as long as it is not the active one */
if (pchan != pchanact) {
- *tar_ob= obact;
- *tar_pchan= pchan;
- found= 1;
+ *tar_ob = obact;
+ *tar_pchan = pchan;
+ found = 1;
break;
}
@@ -1380,23 +1375,22 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* if not yet found, try selected Objects... */
if (found == 0) {
/* search in selected objects context */
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
/* just use the first object we encounter (that isn't the active object)
* and which fulfills the criteria for the object-target that we've got
*/
if ( (ob != obact) &&
- ((!only_curve) || (ob->type == OB_CURVE)) &&
- ((!only_mesh) || (ob->type == OB_MESH)) )
+ ((!only_curve) || (ob->type == OB_CURVE)) &&
+ ((!only_mesh) || (ob->type == OB_MESH)) )
{
/* set target */
- *tar_ob= ob;
- found= 1;
+ *tar_ob = ob;
+ found = 1;
/* perform some special operations on the target */
if (only_curve) {
/* Curve-Path option must be enabled for follow-path constraints to be able to work */
- Curve *cu= (Curve *)ob->data;
+ Curve *cu = (Curve *)ob->data;
cu->flag |= CU_PATH;
}
@@ -1408,17 +1402,17 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* if still not found, add a new empty to act as a target (if allowed) */
if ((found == 0) && (add)) {
- Scene *scene= CTX_data_scene(C);
- Base *base= BASACT, *newbase=NULL;
+ Scene *scene = CTX_data_scene(C);
+ Base *base = BASACT, *newbase = NULL;
Object *obt;
/* add new target object */
- obt= add_object(scene, OB_EMPTY);
+ obt = add_object(scene, OB_EMPTY);
/* set layers OK */
- newbase= BASACT;
- newbase->lay= base->lay;
- obt->lay= newbase->lay;
+ newbase = BASACT;
+ newbase->lay = base->lay;
+ obt->lay = newbase->lay;
/* transform cent to global coords for loc */
if (pchanact) {
@@ -1435,12 +1429,12 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
}
/* restore, add_object sets active */
- BASACT= base;
+ BASACT = base;
base->flag |= SELECT;
/* make our new target the new object */
- *tar_ob= obt;
- found= 1;
+ *tar_ob = obt;
+ found = 1;
}
/* return whether there's any target */
@@ -1450,16 +1444,16 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* used by add constraint operators to add the constraint required */
static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
bPoseChannel *pchan;
bConstraint *con;
if (list == &ob->constraints) {
- pchan= NULL;
+ pchan = NULL;
}
else {
- pchan= get_active_posechannel(ob);
+ pchan = get_active_posechannel(ob);
/* ensure not to confuse object/pose adding */
if (pchan == NULL) {
@@ -1494,8 +1488,8 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
* - apart from the buttons-window add buttons, we shouldn't add in this way
*/
if (setTarget) {
- Object *tar_ob= NULL;
- bPoseChannel *tar_pchan= NULL;
+ Object *tar_ob = NULL;
+ bPoseChannel *tar_pchan = NULL;
/* get the target objects, adding them as need be */
if (get_new_constraint_target(C, type, &tar_ob, &tar_pchan, 1)) {
@@ -1515,7 +1509,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
{
#ifdef WITH_PYTHON
char *menustr;
- int scriptint= 0;
+ int scriptint = 0;
/* popup a list of usable scripts */
menustr = buildmenu_pyconstraints(NULL, &scriptint);
// XXX scriptint = pupmenu(menustr);
@@ -1545,17 +1539,17 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
- if ((ob->type==OB_ARMATURE) && (pchan)) {
- ob->pose->flag |= POSE_RECALC; /* sort pose channels */
- DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+ if ((ob->type == OB_ARMATURE) && (pchan)) {
+ ob->pose->flag |= POSE_RECALC; /* sort pose channels */
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
}
else
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, ob);
return OPERATOR_FINISHED;
}
@@ -1565,9 +1559,9 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* dummy operator callback */
static int object_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob=ED_object_active_context(C);
- int type= RNA_enum_get(op->ptr, "type");
- short with_targets= 0;
+ Object *ob = ED_object_active_context(C);
+ int type = RNA_enum_get(op->ptr, "type");
+ short with_targets = 0;
if (!ob) {
BKE_report(op->reports, RPT_ERROR, "No active object to add constraint to");
@@ -1578,7 +1572,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
* operator name included 'with_targets', since the menu doesn't allow multiple properties
*/
if (strstr(op->idname, "with_targets"))
- with_targets= 1;
+ with_targets = 1;
return constraint_add_exec(C, op, ob, &ob->constraints, type, with_targets);
}
@@ -1586,9 +1580,9 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
/* dummy operator callback */
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= object_pose_armature_get(ED_object_active_context(C));
- int type= RNA_enum_get(op->ptr, "type");
- short with_targets= 0;
+ Object *ob = object_pose_armature_get(ED_object_active_context(C));
+ int type = RNA_enum_get(op->ptr, "type");
+ short with_targets = 0;
if (!ob) {
BKE_report(op->reports, RPT_ERROR, "No active object to add constraint to");
@@ -1599,7 +1593,7 @@ static int pose_constraint_add_exec(bContext *C, wmOperator *op)
* operator name included 'with_targets', since the menu doesn't allow multiple properties
*/
if (strstr(op->idname, "with_targets"))
- with_targets= 1;
+ with_targets = 1;
return constraint_add_exec(C, op, ob, get_active_constraints(ob), type, with_targets);
}
@@ -1619,7 +1613,7 @@ void OBJECT_OT_constraint_add(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1638,7 +1632,7 @@ void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1657,7 +1651,7 @@ void POSE_OT_constraint_add(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1676,7 +1670,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1689,14 +1683,14 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
/* present menu with options + validation for targets to use */
static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
- Object *ob= object_pose_armature_get(CTX_data_active_object(C));
- bPoseChannel *pchan= get_active_posechannel(ob);
- bConstraint *con= NULL;
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
+ bPoseChannel *pchan = get_active_posechannel(ob);
+ bConstraint *con = NULL;
uiPopupMenu *pup;
uiLayout *layout;
- Object *tar_ob= NULL;
- bPoseChannel *tar_pchan= NULL;
+ Object *tar_ob = NULL;
+ bPoseChannel *tar_pchan = NULL;
/* must have active bone */
if (ELEM(NULL, ob, pchan)) {
@@ -1705,8 +1699,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
}
/* bone must not have any constraints already */
- for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_KINEMATIC) break;
+ for (con = pchan->constraints.first; con; con = con->next) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) break;
}
if (con) {
BKE_report(op->reports, RPT_ERROR, "Bone already has IK Constraint");
@@ -1714,8 +1708,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
}
/* prepare popup menu to choose targetting options */
- pup= uiPupMenuBegin(C, "Add IK", ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, "Add IK", ICON_NONE);
+ layout = uiPupMenuLayout(pup);
/* the type of targets we'll set determines the menu entries to show... */
if (get_new_constraint_target(C, CONSTRAINT_TYPE_KINEMATIC, &tar_ob, &tar_pchan, 0)) {
@@ -1742,8 +1736,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
/* call constraint_add_exec() to add the IK constraint */
static int pose_ik_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
- int with_targets= RNA_boolean_get(op->ptr, "with_targets");
+ Object *ob = CTX_data_active_object(C);
+ int with_targets = RNA_boolean_get(op->ptr, "with_targets");
/* add the constraint - all necessary checks should have been done by the invoke() callback already... */
return constraint_add_exec(C, op, ob, get_active_constraints(ob), CONSTRAINT_TYPE_KINEMATIC, with_targets);
@@ -1762,7 +1756,7 @@ void POSE_OT_ik_add(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "with_targets", 1, "With Targets", "Assign IK Constraint with targets derived from the select bones/objects");
@@ -1773,21 +1767,20 @@ void POSE_OT_ik_add(wmOperatorType *ot)
/* remove IK constraints from selected bones */
static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= object_pose_armature_get(CTX_data_active_object(C));
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
/* only remove IK Constraints */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
bConstraint *con, *next;
// TODO: should we be checking if these contraints were local before we try and remove them?
- for (con= pchan->constraints.first; con; con= next) {
- next= con->next;
- if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ for (con = pchan->constraints.first; con; con = next) {
+ next = con->next;
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
remove_constraint(&pchan->constraints, con);
}
}
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
+ pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET);
}
CTX_DATA_END;
@@ -1795,7 +1788,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
return OPERATOR_FINISHED;
}
@@ -1812,6 +1805,6 @@ void POSE_OT_ik_clear(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 2fbc2966bc8..d5385d00c8a 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -101,7 +101,7 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "object_intern.h" // own include
+#include "object_intern.h" // own include
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
@@ -109,7 +109,8 @@ static void waitcursor(int UNUSED(val)) {}
static int pupmenu(const char *UNUSED(msg)) {return 0;}
/* port over here */
-static void error_libdata(void) {}
+static void error_libdata(void) {
+}
Object *ED_object_context(bContext *C)
{
@@ -120,10 +121,10 @@ Object *ED_object_context(bContext *C)
* note: context can be NULL when called from a enum with PROP_ENUM_NO_CONTEXT */
Object *ED_object_active_context(bContext *C)
{
- Object *ob= NULL;
+ Object *ob = NULL;
if (C) {
- ob= ED_object_context(C);
- if (!ob) ob= CTX_data_active_object(C);
+ ob = ED_object_context(C);
+ if (!ob) ob = CTX_data_active_object(C);
}
return ob;
}
@@ -132,15 +133,15 @@ Object *ED_object_active_context(bContext *C)
/* ********* clear/set restrict view *********/
static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- ScrArea *sa= CTX_wm_area(C);
- View3D *v3d= sa->spacedata.first;
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = sa->spacedata.first;
+ Scene *scene = CTX_data_scene(C);
Base *base;
int changed = 0;
/* XXX need a context loop to handle such cases */
- for (base = FIRSTBASE; base; base=base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if ((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
base->flag |= SELECT;
base->object->flag = base->flag;
@@ -151,7 +152,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
if (changed) {
DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
return OPERATOR_FINISHED;
@@ -170,24 +171,24 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_hide_view_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
short changed = 0;
- const int unselected= RNA_boolean_get(op->ptr, "unselected");
+ const int unselected = RNA_boolean_get(op->ptr, "unselected");
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!unselected) {
if (base->flag & SELECT) {
base->flag &= ~SELECT;
base->object->flag = base->flag;
base->object->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
- if (base==BASACT) {
+ if (base == BASACT) {
ED_base_object_activate(C, NULL);
}
}
@@ -205,7 +206,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
}
@@ -224,7 +225,7 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
@@ -233,19 +234,19 @@ 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 *UNUSED(op))
{
- short changed= 0;
+ short changed = 0;
/* XXX need a context loop to handle such cases */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->restrictflag & OB_RESTRICT_RENDER) {
ob->restrictflag &= ~OB_RESTRICT_RENDER;
- changed= 1;
+ changed = 1;
}
}
CTX_DATA_END;
if (changed)
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -263,14 +264,14 @@ void OBJECT_OT_hide_render_clear(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_hide_render_set_exec(bContext *C, wmOperator *op)
{
- const int unselected= RNA_boolean_get(op->ptr, "unselected");
+ const int unselected = RNA_boolean_get(op->ptr, "unselected");
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!unselected) {
if (base->flag & SELECT) {
base->object->restrictflag |= OB_RESTRICT_RENDER;
@@ -283,7 +284,7 @@ static int object_hide_render_set_exec(bContext *C, wmOperator *op)
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -299,7 +300,7 @@ void OBJECT_OT_hide_render_set(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
}
@@ -310,19 +311,19 @@ void ED_object_exit_editmode(bContext *C, int flag)
{
/* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
int freedata = flag & EM_FREEDATA;
- if (obedit==NULL) return;
+ if (obedit == NULL) return;
if (flag & EM_WAITCURSOR) waitcursor(1);
- if (obedit->type==OB_MESH) {
- Mesh *me= obedit->data;
+ if (obedit->type == OB_MESH) {
+ Mesh *me = obedit->data;
// if (EM_texFaceCheck())
- if (me->edit_btmesh->bm->totvert>MESH_MAX_VERTS) {
+ if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
error("Too many vertices");
return;
}
@@ -332,14 +333,14 @@ void ED_object_exit_editmode(bContext *C, int flag)
if (freedata) {
EDBM_mesh_free(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
- me->edit_btmesh= NULL;
+ me->edit_btmesh = NULL;
}
if (obedit->restore_mode & OB_MODE_WEIGHT_PAINT) {
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
}
}
- else if (obedit->type==OB_ARMATURE) {
+ else if (obedit->type == OB_ARMATURE) {
ED_armature_from_edit(obedit);
if (freedata)
ED_armature_edit_free(obedit);
@@ -348,15 +349,15 @@ void ED_object_exit_editmode(bContext *C, int flag)
load_editNurb(obedit);
if (freedata) free_editNurb(obedit);
}
- else if (obedit->type==OB_FONT && freedata) {
+ else if (obedit->type == OB_FONT && freedata) {
load_editText(obedit);
if (freedata) free_editText(obedit);
}
- else if (obedit->type==OB_LATTICE) {
+ else if (obedit->type == OB_LATTICE) {
load_editLatt(obedit);
if (freedata) free_editLatt(obedit);
}
- else if (obedit->type==OB_MBALL) {
+ else if (obedit->type == OB_MBALL) {
load_editMball(obedit);
if (freedata) free_editMball(obedit);
}
@@ -367,11 +368,11 @@ void ED_object_exit_editmode(bContext *C, int flag)
PTCacheID *pid;
/* for example; displist make is different in editmode */
- scene->obedit= NULL; // XXX for context
+ scene->obedit = NULL; // XXX for context
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, obedit, NULL, 0);
- for (pid=pidlist.first; pid; pid=pid->next) {
+ for (pid = pidlist.first; pid; pid = pid->next) {
if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
pid->cache->flag |= PTCACHE_OUTDATED;
}
@@ -380,14 +381,14 @@ void ED_object_exit_editmode(bContext *C, int flag)
BKE_ptcache_object_reset(scene, obedit, PTCACHE_RESET_OUTDATED);
/* also flush ob recalc, doesn't take much overhead, but used for particles */
- DAG_id_tag_update(&obedit->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&obedit->id, OB_RECALC_OB | OB_RECALC_DATA);
if (flag & EM_DO_UNDO)
ED_undo_push(C, "Editmode");
if (flag & EM_WAITCURSOR) waitcursor(0);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
obedit->mode &= ~OB_MODE_EDIT;
}
@@ -396,27 +397,27 @@ void ED_object_exit_editmode(bContext *C, int flag)
void ED_object_enter_editmode(bContext *C, int flag)
{
- Scene *scene= CTX_data_scene(C);
- Base *base= NULL;
+ Scene *scene = CTX_data_scene(C);
+ Base *base = NULL;
Object *ob;
- ScrArea *sa= CTX_wm_area(C);
- View3D *v3d= NULL;
- int ok= 0;
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = NULL;
+ int ok = 0;
if (scene->id.lib) return;
- if (sa && sa->spacetype==SPACE_VIEW3D)
- v3d= sa->spacedata.first;
+ if (sa && sa->spacetype == SPACE_VIEW3D)
+ v3d = sa->spacedata.first;
- if ((flag & EM_IGNORE_LAYER)==0) {
- base= CTX_data_active_base(C); /* active layer checked here for view3d */
+ if ((flag & EM_IGNORE_LAYER) == 0) {
+ base = CTX_data_active_base(C); /* active layer checked here for view3d */
- if (base==NULL) return;
- else if (v3d && (base->lay & v3d->lay)==0) return;
- else if (!v3d && (base->lay & scene->lay)==0) return;
+ if (base == NULL) return;
+ else if (v3d && (base->lay & v3d->lay) == 0) return;
+ else if (!v3d && (base->lay & scene->lay) == 0) return;
}
else {
- base= scene->basact;
+ base = scene->basact;
}
if (ELEM3(NULL, base, base->object, base->object->data)) return;
@@ -434,14 +435,14 @@ void ED_object_enter_editmode(bContext *C, int flag)
/* note, when switching scenes the object can have editmode data but
* not be scene->obedit: bug 22954, this avoids calling self eternally */
- if ((ob->restore_mode & OB_MODE_EDIT)==0)
+ if ((ob->restore_mode & OB_MODE_EDIT) == 0)
ED_object_toggle_modes(C, ob->mode);
- ob->mode= OB_MODE_EDIT;
+ ob->mode = OB_MODE_EDIT;
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em;
- ok= 1;
+ ok = 1;
scene->obedit = ob; /* context sees this */
EDBM_mesh_make(CTX_data_tool_settings(C), scene, ob);
@@ -455,10 +456,10 @@ void ED_object_enter_editmode(bContext *C, int flag)
BM_mesh_select_mode_flush(em->bm);
}
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MESH, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MESH, scene);
}
- else if (ob->type==OB_ARMATURE) {
- bArmature *arm= base->object->data;
+ else if (ob->type == OB_ARMATURE) {
+ bArmature *arm = base->object->data;
if (!arm) return;
/*
* The function object_data_is_libdata make a problem here, the
@@ -472,50 +473,50 @@ void ED_object_enter_editmode(bContext *C, int flag)
error_libdata();
return;
}
- ok=1;
- scene->obedit= ob;
+ ok = 1;
+ scene->obedit = ob;
ED_armature_to_edit(ob);
/* to ensure all goes in restposition and without striding */
- DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME); // XXX: should this be OB_RECALC_DATA?
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); // XXX: should this be OB_RECALC_DATA?
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_ARMATURE, scene);
}
- else if (ob->type==OB_FONT) {
- scene->obedit= ob; // XXX for context
- ok= 1;
+ else if (ob->type == OB_FONT) {
+ scene->obedit = ob; // XXX for context
+ ok = 1;
make_editText(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_TEXT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_TEXT, scene);
}
- else if (ob->type==OB_MBALL) {
- scene->obedit= ob; // XXX for context
- ok= 1;
+ else if (ob->type == OB_MBALL) {
+ scene->obedit = ob; // XXX for context
+ ok = 1;
make_editMball(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MBALL, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MBALL, scene);
}
- else if (ob->type==OB_LATTICE) {
- scene->obedit= ob; // XXX for context
- ok= 1;
+ else if (ob->type == OB_LATTICE) {
+ scene->obedit = ob; // XXX for context
+ ok = 1;
make_editLatt(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_LATTICE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_LATTICE, scene);
}
- else if (ob->type==OB_SURF || ob->type==OB_CURVE) {
- ok= 1;
- scene->obedit= ob; // XXX for context
+ else if (ob->type == OB_SURF || ob->type == OB_CURVE) {
+ ok = 1;
+ scene->obedit = ob; // XXX for context
make_editNurb(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_CURVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_CURVE, scene);
}
if (ok) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
- scene->obedit= NULL; // XXX for context
+ scene->obedit = NULL; // XXX for context
ob->mode &= ~OB_MODE_EDIT;
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
if (flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
@@ -529,7 +530,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
if (!CTX_data_edit_object(C))
ED_object_enter_editmode(C, EM_WAITCURSOR);
else
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
ED_space_image_uv_sculpt_update(CTX_wm_manager(C), toolsettings);
@@ -567,18 +568,18 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
ot->poll = editmode_toggle_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *************************** */
static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
{
- Base *base= CTX_data_active_base(C);
+ Base *base = CTX_data_active_base(C);
- if (base->object->type==OB_ARMATURE) {
- if (base->object==CTX_data_edit_object(C)) {
- ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
+ if (base->object->type == OB_ARMATURE) {
+ if (base->object == CTX_data_edit_object(C)) {
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_DO_UNDO);
ED_armature_enter_posemode(C, base);
}
else if (base->object->mode & OB_MODE_POSE)
@@ -604,7 +605,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flag */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
@@ -612,53 +613,53 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
//XXX no longer used - to be removed - replaced by game_properties_copy_exec
bProperty *prop;
Base *base;
- int nr, tot=0;
+ int nr, tot = 0;
char *str;
- prop= ob->prop.first;
+ prop = ob->prop.first;
while (prop) {
tot++;
- prop= prop->next;
+ prop = prop->next;
}
- str= MEM_callocN(50 + 33*tot, "copymenu prop");
+ str = MEM_callocN(50 + 33 * tot, "copymenu prop");
if (tot)
strcpy(str, "Copy Property %t|Replace All|Merge All|%l");
else
strcpy(str, "Copy Property %t|Clear All (no properties on active)");
- tot= 0;
- prop= ob->prop.first;
+ tot = 0;
+ prop = ob->prop.first;
while (prop) {
tot++;
strcat(str, "|");
strcat(str, prop->name);
- prop= prop->next;
+ prop = prop->next;
}
- nr= pupmenu(str);
+ nr = pupmenu(str);
- if ( nr==1 || nr==2 ) {
- for (base= FIRSTBASE; base; base= base->next) {
- if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
- if (nr==1) { /* replace */
- copy_properties( &base->object->prop, &ob->prop );
+ if (nr == 1 || nr == 2) {
+ for (base = FIRSTBASE; base; base = base->next) {
+ if ((base != BASACT) && (TESTBASELIB(v3d, base))) {
+ if (nr == 1) { /* replace */
+ copy_properties(&base->object->prop, &ob->prop);
}
else {
- for (prop = ob->prop.first; prop; prop= prop->next ) {
+ for (prop = ob->prop.first; prop; prop = prop->next) {
set_ob_property(base->object, prop);
}
}
}
}
}
- else if (nr>0) {
- prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/
+ else if (nr > 0) {
+ prop = BLI_findlink(&ob->prop, nr - 4); /* account for first 3 menu items & menu index starting at 1*/
if (prop) {
- for (base= FIRSTBASE; base; base= base->next) {
- if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
+ for (base = FIRSTBASE; base; base = base->next) {
+ if ((base != BASACT) && (TESTBASELIB(v3d, base))) {
set_ob_property(base->object, prop);
}
}
@@ -673,7 +674,7 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
//XXX no longer used - to be removed - replaced by logicbricks_copy_exec
Base *base;
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (base->object != ob) {
if (TESTBASELIB(v3d, base)) {
@@ -692,12 +693,12 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
set_sca_new_poins_ob(base->object);
/* some menu settings */
- base->object->scavisflag= ob->scavisflag;
- base->object->scaflag= ob->scaflag;
+ base->object->scavisflag = ob->scavisflag;
+ base->object->scaflag = ob->scaflag;
/* set the initial state */
- base->object->state= ob->state;
- base->object->init_state= ob->init_state;
+ base->object->state = ob->state;
+ base->object->init_state = ob->init_state;
}
}
}
@@ -706,49 +707,49 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
/* both pointers should exist */
static void copy_texture_space(Object *to, Object *ob)
{
- float *poin1= NULL, *poin2= NULL;
- short texflag= 0;
+ float *poin1 = NULL, *poin2 = NULL;
+ short texflag = 0;
- if (ob->type==OB_MESH) {
- texflag= ((Mesh *)ob->data)->texflag;
- poin2= ((Mesh *)ob->data)->loc;
+ if (ob->type == OB_MESH) {
+ texflag = ((Mesh *)ob->data)->texflag;
+ poin2 = ((Mesh *)ob->data)->loc;
}
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- texflag= ((Curve *)ob->data)->texflag;
- poin2= ((Curve *)ob->data)->loc;
+ texflag = ((Curve *)ob->data)->texflag;
+ poin2 = ((Curve *)ob->data)->loc;
}
- else if (ob->type==OB_MBALL) {
- texflag= ((MetaBall *)ob->data)->texflag;
- poin2= ((MetaBall *)ob->data)->loc;
+ else if (ob->type == OB_MBALL) {
+ texflag = ((MetaBall *)ob->data)->texflag;
+ poin2 = ((MetaBall *)ob->data)->loc;
}
else
return;
- if (to->type==OB_MESH) {
- ((Mesh *)to->data)->texflag= texflag;
- poin1= ((Mesh *)to->data)->loc;
+ if (to->type == OB_MESH) {
+ ((Mesh *)to->data)->texflag = texflag;
+ poin1 = ((Mesh *)to->data)->loc;
}
else if (ELEM3(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
- ((Curve *)to->data)->texflag= texflag;
- poin1= ((Curve *)to->data)->loc;
+ ((Curve *)to->data)->texflag = texflag;
+ poin1 = ((Curve *)to->data)->loc;
}
- else if (to->type==OB_MBALL) {
- ((MetaBall *)to->data)->texflag= texflag;
- poin1= ((MetaBall *)to->data)->loc;
+ else if (to->type == OB_MBALL) {
+ ((MetaBall *)to->data)->texflag = texflag;
+ poin1 = ((MetaBall *)to->data)->loc;
}
else
return;
- memcpy(poin1, poin2, 9*sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
+ memcpy(poin1, poin2, 9 * sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
- if (to->type==OB_MESH) {
+ if (to->type == OB_MESH) {
/* pass */
}
else if (to->type == OB_MBALL) {
- tex_space_mball(to);
+ BKE_metaball_tex_space_calc(to);
}
else {
- tex_space_curve(to->data);
+ BKE_curve_tex_space_calc(to->data);
}
}
@@ -760,125 +761,125 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
Base *base;
Curve *cu, *cu1;
Nurb *nu;
- int do_scene_sort= 0;
+ int do_scene_sort = 0;
if (scene->id.lib) return;
- if (!(ob=OBACT)) return;
+ if (!(ob = OBACT)) return;
if (scene->obedit) { // XXX get from context
/* obedit_copymenu(); */
return;
}
- if (event==9) {
+ if (event == 9) {
copymenu_properties(scene, v3d, ob);
return;
}
- else if (event==10) {
+ else if (event == 10) {
copymenu_logicbricks(scene, v3d, ob);
return;
}
- else if (event==24) {
+ else if (event == 24) {
/* moved to object_link_modifiers */
/* copymenu_modifiers(bmain, scene, v3d, ob); */
return;
}
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (base != BASACT) {
if (TESTBASELIB(v3d, base)) {
base->object->recalc |= OB_RECALC_OB;
- if (event==1) { /* loc */
+ if (event == 1) { /* loc */
copy_v3_v3(base->object->loc, ob->loc);
copy_v3_v3(base->object->dloc, ob->dloc);
}
- else if (event==2) { /* rot */
+ else if (event == 2) { /* rot */
copy_v3_v3(base->object->rot, ob->rot);
copy_v3_v3(base->object->drot, ob->drot);
copy_qt_qt(base->object->quat, ob->quat);
copy_qt_qt(base->object->dquat, ob->dquat);
}
- else if (event==3) { /* size */
+ else if (event == 3) { /* size */
copy_v3_v3(base->object->size, ob->size);
copy_v3_v3(base->object->dscale, ob->dscale);
}
- else if (event==4) { /* drawtype */
- base->object->dt= ob->dt;
- base->object->dtx= ob->dtx;
- base->object->empty_drawtype= ob->empty_drawtype;
- base->object->empty_drawsize= ob->empty_drawsize;
+ else if (event == 4) { /* drawtype */
+ base->object->dt = ob->dt;
+ base->object->dtx = ob->dtx;
+ base->object->empty_drawtype = ob->empty_drawtype;
+ base->object->empty_drawsize = ob->empty_drawsize;
}
- else if (event==5) { /* time offs */
- base->object->sf= ob->sf;
+ else if (event == 5) { /* time offs */
+ base->object->sf = ob->sf;
}
- else if (event==6) { /* dupli */
- base->object->dupon= ob->dupon;
- base->object->dupoff= ob->dupoff;
- base->object->dupsta= ob->dupsta;
- base->object->dupend= ob->dupend;
+ else if (event == 6) { /* dupli */
+ base->object->dupon = ob->dupon;
+ base->object->dupoff = ob->dupoff;
+ base->object->dupsta = ob->dupsta;
+ base->object->dupend = ob->dupend;
base->object->transflag &= ~OB_DUPLI;
base->object->transflag |= (ob->transflag & OB_DUPLI);
- base->object->dup_group= ob->dup_group;
+ base->object->dup_group = ob->dup_group;
if (ob->dup_group)
id_lib_extern(&ob->dup_group->id);
}
- else if (event==7) { /* mass */
- base->object->mass= ob->mass;
+ else if (event == 7) { /* mass */
+ base->object->mass = ob->mass;
}
- else if (event==8) { /* damping */
- base->object->damping= ob->damping;
- base->object->rdamping= ob->rdamping;
+ else if (event == 8) { /* damping */
+ base->object->damping = ob->damping;
+ base->object->rdamping = ob->rdamping;
}
- else if (event==11) { /* all physical attributes */
+ else if (event == 11) { /* all physical attributes */
base->object->gameflag = ob->gameflag;
base->object->inertia = ob->inertia;
base->object->formfactor = ob->formfactor;
- base->object->damping= ob->damping;
- base->object->rdamping= ob->rdamping;
- base->object->min_vel= ob->min_vel;
- base->object->max_vel= ob->max_vel;
+ base->object->damping = ob->damping;
+ base->object->rdamping = ob->rdamping;
+ base->object->min_vel = ob->min_vel;
+ base->object->max_vel = ob->max_vel;
if (ob->gameflag & OB_BOUNDS) {
base->object->collision_boundtype = ob->collision_boundtype;
}
- base->object->margin= ob->margin;
- base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
+ base->object->margin = ob->margin;
+ base->object->bsoft = copy_bulletsoftbody(ob->bsoft);
}
- else if (event==17) { /* tex space */
+ else if (event == 17) { /* tex space */
copy_texture_space(base->object, ob);
}
- else if (event==18) { /* font settings */
+ else if (event == 18) { /* font settings */
- if (base->object->type==ob->type) {
- cu= ob->data;
- cu1= base->object->data;
-
- cu1->spacemode= cu->spacemode;
- cu1->spacing= cu->spacing;
- cu1->linedist= cu->linedist;
- cu1->shear= cu->shear;
- cu1->fsize= cu->fsize;
- cu1->xof= cu->xof;
- cu1->yof= cu->yof;
- cu1->textoncurve= cu->textoncurve;
- cu1->wordspace= cu->wordspace;
- cu1->ulpos= cu->ulpos;
- cu1->ulheight= cu->ulheight;
+ if (base->object->type == ob->type) {
+ cu = ob->data;
+ cu1 = base->object->data;
+
+ cu1->spacemode = cu->spacemode;
+ cu1->spacing = cu->spacing;
+ cu1->linedist = cu->linedist;
+ cu1->shear = cu->shear;
+ cu1->fsize = cu->fsize;
+ cu1->xof = cu->xof;
+ cu1->yof = cu->yof;
+ cu1->textoncurve = cu->textoncurve;
+ cu1->wordspace = cu->wordspace;
+ cu1->ulpos = cu->ulpos;
+ cu1->ulheight = cu->ulheight;
if (cu1->vfont) cu1->vfont->id.us--;
- cu1->vfont= cu->vfont;
+ cu1->vfont = cu->vfont;
id_us_plus((ID *)cu1->vfont);
if (cu1->vfontb) cu1->vfontb->id.us--;
- cu1->vfontb= cu->vfontb;
+ cu1->vfontb = cu->vfontb;
id_us_plus((ID *)cu1->vfontb);
if (cu1->vfonti) cu1->vfonti->id.us--;
- cu1->vfonti= cu->vfonti;
+ cu1->vfonti = cu->vfonti;
id_us_plus((ID *)cu1->vfonti);
if (cu1->vfontbi) cu1->vfontbi->id.us--;
- cu1->vfontbi= cu->vfontbi;
+ cu1->vfontbi = cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
BKE_text_to_curve(bmain, scene, base->object, 0); /* needed? */
@@ -889,43 +890,43 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if (event==19) { /* bevel settings */
+ else if (event == 19) { /* bevel settings */
if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu= ob->data;
- cu1= base->object->data;
+ cu = ob->data;
+ cu1 = base->object->data;
- cu1->bevobj= cu->bevobj;
- cu1->taperobj= cu->taperobj;
- cu1->width= cu->width;
- cu1->bevresol= cu->bevresol;
- cu1->ext1= cu->ext1;
- cu1->ext2= cu->ext2;
+ cu1->bevobj = cu->bevobj;
+ cu1->taperobj = cu->taperobj;
+ cu1->width = cu->width;
+ cu1->bevresol = cu->bevresol;
+ cu1->ext1 = cu->ext1;
+ cu1->ext2 = cu->ext2;
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if (event==25) { /* curve resolution */
+ else if (event == 25) { /* curve resolution */
if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu= ob->data;
- cu1= base->object->data;
+ cu = ob->data;
+ cu1 = base->object->data;
- cu1->resolu= cu->resolu;
- cu1->resolu_ren= cu->resolu_ren;
+ cu1->resolu = cu->resolu;
+ cu1->resolu_ren = cu->resolu_ren;
- nu= cu1->nurb.first;
+ nu = cu1->nurb.first;
while (nu) {
- nu->resolu= cu1->resolu;
- nu= nu->next;
+ nu->resolu = cu1->resolu;
+ nu = nu->next;
}
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if (event==21) {
- if (base->object->type==OB_MESH) {
+ else if (event == 21) {
+ if (base->object->type == OB_MESH) {
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
if (md) {
@@ -941,42 +942,42 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
}
}
}
- else if (event==22) {
+ else if (event == 22) {
/* Copy the constraint channels over */
copy_constraints(&base->object->constraints, &ob->constraints, TRUE);
- do_scene_sort= 1;
+ do_scene_sort = 1;
}
- else if (event==23) {
- base->object->softflag= ob->softflag;
+ else if (event == 23) {
+ base->object->softflag = ob->softflag;
if (base->object->soft) sbFree(base->object->soft);
- base->object->soft= copy_softbody(ob->soft);
+ base->object->soft = copy_softbody(ob->soft);
if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
}
}
- else if (event==26) {
+ else if (event == 26) {
#if 0 // XXX old animation system
copy_nlastrips(&base->object->nlastrips, &ob->nlastrips);
#endif // XXX old animation system
}
- else if (event==27) { /* autosmooth */
- if (base->object->type==OB_MESH) {
- Mesh *me= ob->data;
- Mesh *cme= base->object->data;
- cme->smoothresh= me->smoothresh;
+ else if (event == 27) { /* autosmooth */
+ if (base->object->type == OB_MESH) {
+ Mesh *me = ob->data;
+ Mesh *cme = base->object->data;
+ cme->smoothresh = me->smoothresh;
if (me->flag & ME_AUTOSMOOTH)
cme->flag |= ME_AUTOSMOOTH;
else
cme->flag &= ~ME_AUTOSMOOTH;
}
}
- else if (event==28) { /* UV orco */
+ else if (event == 28) { /* UV orco */
if (ELEM(base->object->type, OB_CURVE, OB_SURF)) {
- cu= ob->data;
- cu1= base->object->data;
+ cu = ob->data;
+ cu1 = base->object->data;
if (cu->flag & CU_UV_ORCO)
cu1->flag |= CU_UV_ORCO;
@@ -984,13 +985,13 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->flag &= ~CU_UV_ORCO;
}
}
- else if (event==29) { /* protected bits */
- base->object->protectflag= ob->protectflag;
+ else if (event == 29) { /* protected bits */
+ base->object->protectflag = ob->protectflag;
}
- else if (event==30) { /* index object */
- base->object->index= ob->index;
+ else if (event == 30) { /* index object */
+ base->object->index = ob->index;
}
- else if (event==31) { /* object color */
+ else if (event == 31) { /* object color */
copy_v4_v4(base->object->col, ob->col);
}
}
@@ -1003,13 +1004,13 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
DAG_ids_flush_update(bmain, 0);
}
-static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D * v3d)
{
Object *ob;
short event;
char str[512];
- if (!(ob=OBACT)) return;
+ if (!(ob = OBACT)) return;
if (scene->obedit) { // XXX get from context
// if (ob->type == OB_MESH)
@@ -1028,8 +1029,8 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
"Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|"
"Logic Bricks%x10|Protected Transform%x29|%l");
- strcat (str, "|Object Constraints%x22");
- strcat (str, "|NLA Strips%x26");
+ strcat(str, "|Object Constraints%x22");
+ strcat(str, "|NLA Strips%x26");
// XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
// strcat(str, "|Texture Space%x17");
@@ -1039,10 +1040,10 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
if (ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
if ((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
- strcat(str, "|Curve Resolution%x25");
+ strcat(str, "|Curve Resolution%x25");
}
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
}
@@ -1050,12 +1051,12 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
strcat(str, "|Pass Index%x30");
- if (ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF) {
+ if (ob->type == OB_MESH || ob->type == OB_CURVE || ob->type == OB_LATTICE || ob->type == OB_SURF) {
strcat(str, "|Modifiers ...%x24");
}
- event= pupmenu(str);
- if (event<= 0) return;
+ event = pupmenu(str);
+ if (event <= 0) return;
copy_attr(bmain, scene, v3d, event);
}
@@ -1074,7 +1075,7 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
else
ob->pd->forcefield = 0;
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
return OPERATOR_FINISHED;
}
@@ -1092,7 +1093,7 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************************************** */
@@ -1108,8 +1109,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
ListBase targets = {NULL, NULL};
/* loop over objects in scene */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
/* set flag to force recalc, then grab the relevant bones to target */
ob->avs.recalc |= ANIMVIZ_RECALC_PATHS;
animviz_get_object_motionpaths(ob, &targets);
@@ -1124,12 +1124,12 @@ 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 *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* set up path data for bones being calculated */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
/* verify makes sure that the selected bone has a bone with the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, NULL);
@@ -1141,12 +1141,12 @@ static int object_calculate_paths_exec (bContext *C, wmOperator *op)
ED_objects_recalculate_paths(C, scene);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
return OPERATOR_FINISHED;
}
-void OBJECT_OT_paths_calculate (wmOperatorType *ot)
+void OBJECT_OT_paths_calculate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Calculate Object Paths";
@@ -1158,7 +1158,7 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* --------- */
@@ -1167,11 +1167,11 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot)
void ED_objects_clear_paths(bContext *C)
{
/* loop over objects in scene */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
if (ob->mpath) {
animviz_free_motionpath(ob->mpath);
- ob->mpath= NULL;
+ ob->mpath = NULL;
ob->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
}
}
@@ -1179,18 +1179,18 @@ void ED_objects_clear_paths(bContext *C)
}
/* operator callback for this */
-static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
+static int object_clear_paths_exec(bContext *C, wmOperator *UNUSED(op))
{
/* use the backend function for this */
ED_objects_clear_paths(C);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
return OPERATOR_FINISHED;
}
-void OBJECT_OT_paths_clear (wmOperatorType *ot)
+void OBJECT_OT_paths_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Object Paths";
@@ -1202,7 +1202,7 @@ void OBJECT_OT_paths_clear (wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1212,36 +1212,36 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
{
Curve *cu;
Nurb *nu;
- int clear= (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0);
- int done= 0;
+ int clear = (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0);
+ int done = 0;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
mesh_set_smooth_flag(ob, !clear);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- done= 1;
+ done = 1;
}
else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
- cu= ob->data;
+ cu = ob->data;
- for (nu=cu->nurb.first; nu; nu=nu->next) {
+ for (nu = cu->nurb.first; nu; nu = nu->next) {
if (!clear) nu->flag |= ME_SMOOTH;
else nu->flag &= ~ME_SMOOTH;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- done= 1;
+ done = 1;
}
}
CTX_DATA_END;
- return (done)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+ return (done) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
static int shade_poll(bContext *C)
@@ -1261,7 +1261,7 @@ void OBJECT_OT_shade_flat(wmOperatorType *ot)
ot->exec = shade_smooth_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
void OBJECT_OT_shade_smooth(wmOperatorType *ot)
@@ -1276,12 +1276,12 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
ot->exec = shade_smooth_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************** */
-static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(image_aspect) (Scene * scene, View3D * v3d)
{
/* all selected objects with an image map: scale in image aspect */
Base *base;
@@ -1291,42 +1291,42 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
float x, y, space;
int a, b, done;
- if (scene->obedit) return; // XXX get from context
+ if (scene->obedit) return; // XXX get from context
if (scene->id.lib) return;
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASELIB(v3d, base)) {
- ob= base->object;
- done= 0;
+ ob = base->object;
+ done = 0;
- for (a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
+ for (a = 1; a <= ob->totcol; a++) {
+ ma = give_current_material(ob, a);
if (ma) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (ma->mtex[b] && ma->mtex[b]->tex) {
- tex= ma->mtex[b]->tex;
- if (tex->type==TEX_IMAGE && tex->ima) {
- ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, NULL);
+ tex = ma->mtex[b]->tex;
+ if (tex->type == TEX_IMAGE && tex->ima) {
+ ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, NULL);
/* texturespace */
- space= 1.0;
- if (ob->type==OB_MESH) {
+ space = 1.0;
+ if (ob->type == OB_MESH) {
float size[3];
mesh_get_texspace(ob->data, NULL, NULL, size);
- space= size[0]/size[1];
+ space = size[0] / size[1];
}
else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
- Curve *cu= ob->data;
- space= cu->size[0]/cu->size[1];
+ Curve *cu = ob->data;
+ space = cu->size[0] / cu->size[1];
}
- x= ibuf->x/space;
- y= ibuf->y;
+ x = ibuf->x / space;
+ y = ibuf->y;
- if (x>y) ob->size[0]= ob->size[1]*x/y;
- else ob->size[1]= ob->size[0]*y/x;
+ if (x > y) ob->size[0] = ob->size[1] * x / y;
+ else ob->size[1] = ob->size[0] * y / x;
- done= 1;
+ done = 1;
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
@@ -1344,30 +1344,32 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *input = object_mode_items;
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
Object *ob;
- int totitem= 0;
+ int totitem = 0;
if (!C) /* needed for docs */
return object_mode_items;
+
+
ob = CTX_data_active_object(C);
while (ob && input->identifier) {
- if ((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
- (ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
- (ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) ||
- (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
- (input->value == OB_MODE_PARTICLE_EDIT && ob->particlesystem.first) ||
- ((input->value == OB_MODE_SCULPT || input->value == OB_MODE_VERTEX_PAINT ||
- input->value == OB_MODE_WEIGHT_PAINT || input->value == OB_MODE_TEXTURE_PAINT) && (ob->type == OB_MESH)) ||
- (input->value == OB_MODE_OBJECT))
+ if ((input->value == OB_MODE_EDIT && OB_TYPE_SUPPORT_EDITMODE(ob->type)) ||
+ (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
+ (input->value == OB_MODE_PARTICLE_EDIT && ob->particlesystem.first) ||
+ ((input->value == OB_MODE_SCULPT || input->value == OB_MODE_VERTEX_PAINT ||
+ input->value == OB_MODE_WEIGHT_PAINT || input->value == OB_MODE_TEXTURE_PAINT) && (ob->type == OB_MESH)) ||
+ (input->value == OB_MODE_OBJECT))
+ {
RNA_enum_item_add(&item, &totitem, input);
+ }
++input;
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -1401,24 +1403,24 @@ static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *o
if (mode == OB_MODE_OBJECT)
return 1;
- switch(ob->type) {
- case OB_MESH:
- if (mode & (OB_MODE_EDIT|OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))
- return 1;
- return 0;
- case OB_CURVE:
- case OB_SURF:
- case OB_FONT:
- case OB_MBALL:
- if (mode & (OB_MODE_EDIT))
- return 1;
- return 0;
- case OB_LATTICE:
- if (mode & (OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
- return 1;
- case OB_ARMATURE:
- if (mode & (OB_MODE_EDIT|OB_MODE_POSE))
- return 1;
+ switch (ob->type) {
+ case OB_MESH:
+ if (mode & (OB_MODE_EDIT | OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_PARTICLE_EDIT))
+ return 1;
+ return 0;
+ case OB_CURVE:
+ case OB_SURF:
+ case OB_FONT:
+ case OB_MBALL:
+ if (mode & (OB_MODE_EDIT))
+ return 1;
+ return 0;
+ case OB_LATTICE:
+ if (mode & (OB_MODE_EDIT | OB_MODE_WEIGHT_PAINT))
+ return 1;
+ case OB_ARMATURE:
+ if (mode & (OB_MODE_EDIT | OB_MODE_POSE))
+ return 1;
}
}
@@ -1427,7 +1429,7 @@ static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *o
static int object_mode_set_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
ObjectMode mode = RNA_enum_get(op->ptr, "mode");
ObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT;
int toggle = RNA_boolean_get(op->ptr, "toggle");
@@ -1474,7 +1476,7 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
/* flags */
ot->flag = 0; /* no register/undo here, leave it to operators being called */
- prop= RNA_def_enum(ot->srna, "mode", object_mode_items, OB_MODE_OBJECT, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", object_mode_items, OB_MODE_OBJECT, "Mode", "");
RNA_def_enum_funcs(prop, object_mode_set_itemsf);
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
@@ -1504,12 +1506,12 @@ void ED_object_toggle_modes(bContext *C, int mode)
static int game_property_new(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
bProperty *prop;
char name[MAX_NAME];
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
- prop= new_property(type);
+ prop = new_property(type);
BLI_addtail(&ob->prop, prop);
RNA_string_get(op->ptr, "name", name);
@@ -1536,7 +1538,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", gameproperty_type_items, GPROP_FLOAT, "Type", "Type of game property to add");
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the game property to add");
@@ -1544,14 +1546,14 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
static int game_property_remove(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
bProperty *prop;
- int index= RNA_int_get(op->ptr, "index");
+ int index = RNA_int_get(op->ptr, "index");
if (!ob)
return OPERATOR_CANCELLED;
- prop= BLI_findlink(&ob->prop, index);
+ prop = BLI_findlink(&ob->prop, index);
if (prop) {
BLI_remlink(&ob->prop, prop);
@@ -1577,16 +1579,16 @@ void OBJECT_OT_game_property_remove(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX);
}
-#define COPY_PROPERTIES_REPLACE 1
-#define COPY_PROPERTIES_MERGE 2
-#define COPY_PROPERTIES_COPY 3
+#define COPY_PROPERTIES_REPLACE 1
+#define COPY_PROPERTIES_MERGE 2
+#define COPY_PROPERTIES_COPY 3
-static EnumPropertyItem game_properties_copy_operations[] ={
+static EnumPropertyItem game_properties_copy_operations[] = {
{COPY_PROPERTIES_REPLACE, "REPLACE", 0, "Replace Properties", ""},
{COPY_PROPERTIES_MERGE, "MERGE", 0, "Merge Properties", ""},
{COPY_PROPERTIES_COPY, "COPY", 0, "Copy a Property", ""},
@@ -1597,40 +1599,40 @@ static EnumPropertyItem gameprops_items[]= {
static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob= ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
bProperty *prop;
- int a, totitem= 0;
+ int a, totitem = 0;
if (!ob)
return gameprops_items;
- for (a=1, prop= ob->prop.first; prop; prop=prop->next, a++) {
- tmp.value= a;
- tmp.identifier= prop->name;
- tmp.name= prop->name;
+ for (a = 1, prop = ob->prop.first; prop; prop = prop->next, a++) {
+ tmp.value = a;
+ tmp.identifier = prop->name;
+ tmp.name = prop->name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
static int game_property_copy_exec(bContext *C, wmOperator *op)
{
- Object *ob=ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
bProperty *prop;
int type = RNA_enum_get(op->ptr, "operation");
- int propid= RNA_enum_get(op->ptr, "property");
+ int propid = RNA_enum_get(op->ptr, "property");
if (propid > 0) { /* copy */
- prop = BLI_findlink(&ob->prop, propid-1);
+ prop = BLI_findlink(&ob->prop, propid - 1);
if (prop) {
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter)
set_ob_property(ob_iter, prop);
} CTX_DATA_END;
@@ -1638,14 +1640,14 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
}
else {
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
if (type == COPY_PROPERTIES_REPLACE)
copy_properties(&ob_iter->prop, &ob->prop);
/* merge - the default when calling with no argument */
else
- for (prop = ob->prop.first; prop; prop= prop->next)
+ for (prop = ob->prop.first; prop; prop = prop->next)
set_ob_property(ob_iter, prop);
}
}
@@ -1667,17 +1669,17 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "operation", game_properties_copy_operations, 3, "Operation", "");
- prop=RNA_def_enum(ot->srna, "property", gameprops_items, 0, "Property", "Properties to copy");
+ prop = RNA_def_enum(ot->srna, "property", gameprops_items, 0, "Property", "Properties to copy");
RNA_def_enum_funcs(prop, gameprops_itemf);
ot->prop = prop;
}
static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
free_properties(&ob_iter->prop);
}
CTX_DATA_END;
@@ -1696,16 +1698,16 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ Copy Logic Bricks ***********************/
static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob=ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
/* first: free all logic */
free_sensors(&ob_iter->sensors);
@@ -1722,16 +1724,16 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
set_sca_new_poins_ob(ob_iter);
/* some menu settings */
- ob_iter->scavisflag= ob->scavisflag;
- ob_iter->scaflag= ob->scaflag;
+ ob_iter->scavisflag = ob->scavisflag;
+ ob_iter->scaflag = ob->scaflag;
/* set the initial state */
- ob_iter->state= ob->state;
- ob_iter->init_state= ob->init_state;
+ ob_iter->state = ob->state;
+ ob_iter->init_state = ob->init_state;
- if (ob_iter->totcol==ob->totcol) {
- ob_iter->actcol= ob->actcol;
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
+ if (ob_iter->totcol == ob->totcol) {
+ ob_iter->actcol = ob->actcol;
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_iter);
}
}
}
@@ -1754,14 +1756,14 @@ void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob=ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
ob_iter->gameflag = ob->gameflag;
ob_iter->gameflag2 = ob->gameflag2;
@@ -1781,7 +1783,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
if (ob->restrictflag & OB_RESTRICT_RENDER)
ob_iter->restrictflag |= OB_RESTRICT_RENDER;
- else
+ else
ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
}
}
@@ -1802,5 +1804,5 @@ void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 3867b1e34cb..702671d8d9b 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -61,9 +61,9 @@
static int objects_add_active_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= OBACT;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = OBACT;
Group *group;
int ok = 0, cycle = 0;
@@ -72,10 +72,10 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
/* linking to same group requires its own loop so we can avoid
* looking up the active objects groups each time */
- for (group= bmain->group.first; group; group=group->id.next) {
+ for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group)) {
/* Assign groups to selected objects */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object->dup_group != group)
add_to_group(group, base->object, scene, base);
else
@@ -91,7 +91,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -108,14 +108,14 @@ void GROUP_OT_objects_add_active(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int objects_remove_active_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= OBACT;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = OBACT;
Group *group;
int ok = 0;
@@ -124,10 +124,10 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
/* linking to same group requires its own loop so we can avoid
* looking up the active objects groups each time */
- for (group= bmain->group.first; group; group=group->id.next) {
+ for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group)) {
/* Assign groups to selected objects */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
rem_from_group(group, base->object, scene, base);
ok = 1;
}
@@ -138,7 +138,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -155,16 +155,16 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Group *group= NULL;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Group *group = NULL;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
group = NULL;
while ((group = find_group(base->object, group)))
rem_from_group(group, base->object, scene, base);
@@ -172,7 +172,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -189,27 +189,27 @@ void GROUP_OT_objects_remove(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_create_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Group *group= NULL;
- char name[MAX_ID_NAME-2]; /* id name */
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Group *group = NULL;
+ char name[MAX_ID_NAME - 2]; /* id name */
RNA_string_get(op->ptr, "name", name);
- group= add_group(name);
+ group = add_group(name);
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
add_to_group(group, base->object, scene, base);
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -226,26 +226,26 @@ void GROUP_OT_create(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME-2, "Name", "Name of the new group");
+ RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME - 2, "Name", "Name of the new group");
}
/****************** properties window operators *********************/
static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
Group *group;
if (ob == NULL)
return OPERATOR_CANCELLED;
- group= add_group("Group");
+ group = add_group("Group");
add_to_group(group, ob, scene, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -261,21 +261,21 @@ void OBJECT_OT_group_add(wmOperatorType *ot)
ot->exec = group_add_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_link_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
- Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
+ Group *group = BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
if (ELEM(NULL, ob, group))
return OPERATOR_CANCELLED;
add_to_group(group, ob, scene, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -294,26 +294,26 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
ot->invoke = WM_enum_search_invoke;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
RNA_def_enum_funcs(prop, RNA_group_local_itemf);
ot->prop = prop;
}
static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
- Group *group= CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
+ Group *group = CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
if (!ob || !group)
return OPERATOR_CANCELLED;
rem_from_group(group, ob, scene, NULL); /* base will be used if found */
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -328,6 +328,6 @@ void OBJECT_OT_group_remove(wmOperatorType *ot)
ot->exec = group_remove_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index ef428b5b1b7..4ffc3e8c19f 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -76,27 +76,27 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
{
BMVert *eve;
BMIter iter;
- int *index, nr, totvert=0;
+ int *index, nr, totvert = 0;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) totvert++;
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
+ *indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
+ *tot = totvert;
+ nr = 0;
zero_v3(cent);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, eve->co);
}
nr++;
}
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return totvert;
}
@@ -106,8 +106,8 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
zero_v3(cent);
if (obedit->actdef) {
- const int defgrp_index= obedit->actdef-1;
- int totvert=0;
+ const int defgrp_index = obedit->actdef - 1;
+ int totvert = 0;
MDeformVert *dvert;
BMVert *eve;
@@ -115,7 +115,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
/* find the vertices */
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dvert) {
if (defvert_find_weight(dvert, defgrp_index) > 0.0f) {
@@ -127,7 +127,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
if (totvert) {
bDeformGroup *dg = BLI_findlink(&obedit->defbase, defgrp_index);
BLI_strncpy(name, dg->name, sizeof(dg->name));
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return 1;
}
}
@@ -137,19 +137,19 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
{
- Mesh *me= ob->data;
- BMEditMesh *em= me->edit_btmesh;
+ Mesh *me = ob->data;
+ BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMIter iter;
- int index=0, nr=0;
+ int index = 0, nr = 0;
if (hmd->indexar == NULL)
return;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- if (nr==hmd->indexar[index]) {
+ if (nr == hmd->indexar[index]) {
BM_vert_select_set(em->bm, eve, TRUE);
- if (index < hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
@@ -161,31 +161,31 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar, float *cent)
{
BPoint *bp;
- int *index, nr, totvert=0, a;
+ int *index, nr, totvert = 0, a;
/* count */
- a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
- bp= editlatt->def;
+ a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw;
+ bp = editlatt->def;
while (a--) {
if (bp->f1 & SELECT) {
- if (bp->hide==0) totvert++;
+ if (bp->hide == 0) totvert++;
}
bp++;
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
+ *indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
+ *tot = totvert;
+ nr = 0;
zero_v3(cent);
- a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
- bp= editlatt->def;
+ a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw;
+ bp = editlatt->def;
while (a--) {
if (bp->f1 & SELECT) {
- if (bp->hide==0) {
- *index= nr; index++;
+ if (bp->hide == 0) {
+ *index = nr; index++;
add_v3_v3(cent, bp->vec);
}
}
@@ -193,25 +193,25 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
nr++;
}
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return totvert;
}
static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
{
- Lattice *lt= obedit->data, *editlt;
+ Lattice *lt = obedit->data, *editlt;
BPoint *bp;
- int index=0, nr=0, a;
+ int index = 0, nr = 0, a;
- editlt= lt->editlatt->latt;
+ editlt = lt->editlatt->latt;
/* count */
- a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
- bp= editlt->def;
+ a = editlt->pntsu * editlt->pntsv * editlt->pntsw;
+ bp = editlt->def;
while (a--) {
- if (hmd->indexar[index]==nr) {
+ if (hmd->indexar[index] == nr) {
bp->f1 |= SELECT;
- if (index < hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
bp++;
@@ -220,16 +220,16 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, float *cent)
{
- ListBase *editnurb= object_editcurve_get(obedit);
+ ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
- int *index, a, nr, totvert=0;
+ int *index, a, nr, totvert = 0;
- for (nu= editnurb->first; nu; nu= nu->next) {
+ for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (bezt->f1 & SELECT) totvert++;
if (bezt->f2 & SELECT) totvert++;
@@ -238,38 +238,38 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) totvert++;
bp++;
}
}
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
+ *indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
+ *tot = totvert;
+ nr = 0;
zero_v3(cent);
- for (nu= editnurb->first; nu; nu= nu->next) {
+ for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (bezt->f1 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bezt->vec[0]);
}
nr++;
if (bezt->f2 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bezt->vec[1]);
}
nr++;
if (bezt->f3 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bezt->vec[2]);
}
nr++;
@@ -277,11 +277,11 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bp->vec);
}
nr++;
@@ -290,21 +290,21 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return totvert;
}
static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
{
- *indexar= NULL;
- *tot= 0;
- name[0]= 0;
+ *indexar = NULL;
+ *tot = 0;
+ name[0] = 0;
- switch(obedit->type) {
+ switch (obedit->type) {
case OB_MESH:
{
- Mesh *me= obedit->data;
+ Mesh *me = obedit->data;
BMEditMesh *em;
@@ -314,7 +314,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
em = me->edit_btmesh;
/* check selected vertices first */
- if ( return_editmesh_indexar(em, tot, indexar, cent_r)) {
+ if (return_editmesh_indexar(em, tot, indexar, cent_r)) {
return 1;
}
else {
@@ -327,7 +327,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
return return_editcurve_indexar(obedit, tot, indexar, cent_r);
case OB_LATTICE:
{
- Lattice *lt= obedit->data;
+ Lattice *lt = obedit->data;
return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
}
default:
@@ -337,30 +337,30 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
{
- ListBase *editnurb= object_editcurve_get(obedit);
+ ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
- int index=0, a, nr=0;
+ int index = 0, a, nr = 0;
- for (nu= editnurb->first; nu; nu= nu->next) {
+ for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (nr == hmd->indexar[index]) {
bezt->f1 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
if (nr == hmd->indexar[index]) {
bezt->f2 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
if (nr == hmd->indexar[index]) {
bezt->f3 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
@@ -368,12 +368,12 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (nr == hmd->indexar[index]) {
bp->f1 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
bp++;
@@ -387,17 +387,17 @@ static void object_hook_select(Object *ob, HookModifierData *hmd)
if (hmd->indexar == NULL)
return;
- if (ob->type==OB_MESH) select_editbmesh_hook(ob, hmd);
- else if (ob->type==OB_LATTICE) select_editlattice_hook(ob, hmd);
- else if (ob->type==OB_CURVE) select_editcurve_hook(ob, hmd);
- else if (ob->type==OB_SURF) select_editcurve_hook(ob, hmd);
+ if (ob->type == OB_MESH) select_editbmesh_hook(ob, hmd);
+ else if (ob->type == OB_LATTICE) select_editlattice_hook(ob, hmd);
+ else if (ob->type == OB_CURVE) select_editcurve_hook(ob, hmd);
+ else if (ob->type == OB_SURF) select_editcurve_hook(ob, hmd);
}
/* special poll operators for hook operators */
// TODO: check for properties window modifier context too as alternative?
static int hook_op_edit_poll(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
if (obedit) {
if (ED_operator_editmesh(C)) return 1;
@@ -414,7 +414,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit)
Base *base, *basedit;
Object *ob;
- ob= add_object(scene, OB_EMPTY);
+ ob = add_object(scene, OB_EMPTY);
basedit = object_in_scene(obedit, scene);
base = object_in_scene(ob, scene);
@@ -429,7 +429,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit)
static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode)
{
- ModifierData *md=NULL;
+ ModifierData *md = NULL;
HookModifierData *hmd = NULL;
float cent[3];
int tot, ok, *indexar;
@@ -437,9 +437,9 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
- if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group");
+ if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group");
- if (mode==OBJECT_ADDHOOK_NEWOB && !ob) {
+ if (mode == OBJECT_ADDHOOK_NEWOB && !ob) {
ob = add_hook_object_new(scene, obedit);
@@ -448,19 +448,19 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
}
md = obedit->modifiers.first;
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
+ while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform) {
md = md->next;
}
- hmd = (HookModifierData*) modifier_new(eModifierType_Hook);
+ hmd = (HookModifierData *) modifier_new(eModifierType_Hook);
BLI_insertlinkbefore(&obedit->modifiers, md, hmd);
- BLI_snprintf(hmd->modifier.name, sizeof(hmd->modifier.name), "Hook-%s", ob->id.name+2);
- modifier_unique_name(&obedit->modifiers, (ModifierData*)hmd);
+ BLI_snprintf(hmd->modifier.name, sizeof(hmd->modifier.name), "Hook-%s", ob->id.name + 2);
+ modifier_unique_name(&obedit->modifiers, (ModifierData *)hmd);
- hmd->object= ob;
- hmd->indexar= indexar;
+ hmd->object = ob;
+ hmd->indexar = indexar;
copy_v3_v3(hmd->cent, cent);
- hmd->totindex= tot;
+ hmd->totindex = tot;
BLI_strncpy(hmd->name, name, sizeof(hmd->name));
/* matrix calculus */
@@ -478,13 +478,12 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
- Object *obsel=NULL;
+ Object *obsel = NULL;
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
if (ob != obedit) {
obsel = ob;
break;
@@ -499,7 +498,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
add_hook_object(bmain, scene, obedit, obsel, OBJECT_ADDHOOK_SELOB);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
@@ -515,19 +514,19 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
@@ -543,14 +542,14 @@ void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_hook_remove_exec(bContext *C, wmOperator *op)
{
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
@@ -566,7 +565,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
modifier_free((ModifierData *)hmd);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -575,25 +574,25 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), Pr
{
Object *ob = CTX_data_edit_object(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
ModifierData *md = NULL;
- int a, totitem= 0;
+ int a, totitem = 0;
if (!ob)
return DummyRNA_NULL_items;
- for (a=0, md=ob->modifiers.first; md; md= md->next, a++) {
- if (md->type==eModifierType_Hook) {
- tmp.value= a;
+ for (a = 0, md = ob->modifiers.first; md; md = md->next, a++) {
+ if (md->type == eModifierType_Hook) {
+ tmp.value = a;
tmp.icon = ICON_HOOK;
- tmp.identifier= md->name;
- tmp.name= md->name;
+ tmp.identifier = md->name;
+ tmp.name = md->name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -615,26 +614,26 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot)
/* flags */
/* this operator removes modifier which isn't stored in local undo stack,
* so redoing it from redo panel gives totally weird results */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
RNA_def_enum_funcs(prop, hook_mod_itemf);
ot->prop = prop;
}
static int object_hook_reset_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -645,7 +644,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
/* reset functionality */
if (hmd->object) {
- bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
+ bPoseChannel *pchan = get_pose_channel(hmd->object->pose, hmd->subtarget);
if (hmd->subtarget[0] && pchan) {
float imat[4][4], mat[4][4];
@@ -663,7 +662,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -682,27 +681,27 @@ void OBJECT_OT_hook_reset(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
static int object_hook_recenter_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
Scene *scene = CTX_data_scene(C);
float bmat[3][3], imat[3][3];
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -719,7 +718,7 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op)
mul_m3_v3(imat, hmd->cent);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -738,29 +737,29 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
static int object_hook_assign_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ Scene *scene = CTX_data_scene(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
float cent[3];
char name[MAX_NAME];
int *indexar, tot;
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -779,11 +778,11 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
MEM_freeN(hmd->indexar);
copy_v3_v3(hmd->cent, cent);
- hmd->indexar= indexar;
- hmd->totindex= tot;
+ hmd->indexar = indexar;
+ hmd->totindex = tot;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -804,25 +803,25 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot)
/* flags */
/* this operator changes data stored in modifier which doesn't get pushed to undo stack,
* so redoing it from redo panel gives totally weird results */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
static int object_hook_select_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -834,7 +833,7 @@ static int object_hook_select_exec(bContext *C, wmOperator *op)
/* select functionality */
object_hook_select(ob, hmd);
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -853,10 +852,10 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 8ba64e66025..28de0b4b33f 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -185,7 +185,7 @@ void CONSTRAINT_OT_limitdistance_reset(struct wmOperatorType *ot);
void CONSTRAINT_OT_childof_set_inverse(struct wmOperatorType *ot);
void CONSTRAINT_OT_childof_clear_inverse(struct wmOperatorType *ot);
void CONSTRAINT_OT_objectsolver_set_inverse(struct wmOperatorType *ot);
-void CONSTRAINT_OT_objectsolver_clear_inverse (struct wmOperatorType *ot);
+void CONSTRAINT_OT_objectsolver_clear_inverse(struct wmOperatorType *ot);
/* object_vgroup.c */
void OBJECT_OT_vertex_group_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 4ba62541c60..648f530881a 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -68,45 +68,45 @@
void free_editLatt(Object *ob)
{
- Lattice *lt= ob->data;
+ Lattice *lt = ob->data;
if (lt->editlatt) {
- Lattice *editlt= lt->editlatt->latt;
+ Lattice *editlt = lt->editlatt->latt;
if (editlt->def)
MEM_freeN(editlt->def);
if (editlt->dvert)
- free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw);
+ free_dverts(editlt->dvert, editlt->pntsu * editlt->pntsv * editlt->pntsw);
MEM_freeN(editlt);
MEM_freeN(lt->editlatt);
- lt->editlatt= NULL;
+ lt->editlatt = NULL;
}
}
void make_editLatt(Object *obedit)
{
- Lattice *lt= obedit->data;
+ Lattice *lt = obedit->data;
KeyBlock *actkey;
free_editLatt(obedit);
- actkey= ob_get_keyblock(obedit);
+ actkey = ob_get_keyblock(obedit);
if (actkey)
key_to_latt(actkey, lt);
- lt->editlatt= MEM_callocN(sizeof(EditLatt), "editlatt");
- lt->editlatt->latt= MEM_dupallocN(lt);
- lt->editlatt->latt->def= MEM_dupallocN(lt->def);
+ lt->editlatt = MEM_callocN(sizeof(EditLatt), "editlatt");
+ lt->editlatt->latt = MEM_dupallocN(lt);
+ lt->editlatt->latt->def = MEM_dupallocN(lt->def);
if (lt->dvert) {
- int tot= lt->pntsu*lt->pntsv*lt->pntsw;
- lt->editlatt->latt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+ int tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ lt->editlatt->latt->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot);
}
- if (lt->key) lt->editlatt->shapenr= obedit->shapenr;
+ if (lt->key) lt->editlatt->shapenr = obedit->shapenr;
}
void load_editLatt(Object *obedit)
@@ -117,52 +117,52 @@ void load_editLatt(Object *obedit)
float *fp;
int tot;
- lt= obedit->data;
- editlt= lt->editlatt->latt;
+ lt = obedit->data;
+ editlt = lt->editlatt->latt;
if (lt->editlatt->shapenr) {
- actkey= BLI_findlink(&lt->key->block, lt->editlatt->shapenr-1);
+ actkey = BLI_findlink(&lt->key->block, lt->editlatt->shapenr - 1);
/* active key: vertices */
- tot= editlt->pntsu*editlt->pntsv*editlt->pntsw;
+ tot = editlt->pntsu * editlt->pntsv * editlt->pntsw;
if (actkey->data) MEM_freeN(actkey->data);
- fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
- actkey->totelem= tot;
+ fp = actkey->data = MEM_callocN(lt->key->elemsize * tot, "actkey->data");
+ actkey->totelem = tot;
- bp= editlt->def;
+ bp = editlt->def;
while (tot--) {
copy_v3_v3(fp, bp->vec);
- fp+= 3;
+ fp += 3;
bp++;
}
}
else {
MEM_freeN(lt->def);
- lt->def= MEM_dupallocN(editlt->def);
+ lt->def = MEM_dupallocN(editlt->def);
- lt->flag= editlt->flag;
+ lt->flag = editlt->flag;
- lt->pntsu= editlt->pntsu;
- lt->pntsv= editlt->pntsv;
- lt->pntsw= editlt->pntsw;
+ lt->pntsu = editlt->pntsu;
+ lt->pntsv = editlt->pntsv;
+ lt->pntsw = editlt->pntsw;
- lt->typeu= editlt->typeu;
- lt->typev= editlt->typev;
- lt->typew= editlt->typew;
+ lt->typeu = editlt->typeu;
+ lt->typev = editlt->typev;
+ lt->typew = editlt->typew;
}
if (lt->dvert) {
- free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
- lt->dvert= NULL;
+ free_dverts(lt->dvert, lt->pntsu * lt->pntsv * lt->pntsw);
+ lt->dvert = NULL;
}
if (editlt->dvert) {
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
- lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+ lt->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(lt->dvert, editlt->dvert, tot);
}
}
@@ -171,17 +171,17 @@ void load_editLatt(Object *obedit)
void ED_setflagsLatt(Object *obedit, int flag)
{
- Lattice *lt= obedit->data;
+ Lattice *lt = obedit->data;
BPoint *bp;
int a;
- bp= lt->editlatt->latt->def;
+ bp = lt->editlatt->latt->def;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
while (a--) {
- if (bp->hide==0) {
- bp->f1= flag;
+ if (bp->hide == 0) {
+ bp->f1 = flag;
}
bp++;
}
@@ -189,8 +189,8 @@ void ED_setflagsLatt(Object *obedit, int flag)
static int lattice_select_all_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
- Lattice *lt= obedit->data;
+ Object *obedit = CTX_data_edit_object(C);
+ Lattice *lt = obedit->data;
BPoint *bp;
int a;
int action = RNA_enum_get(op->ptr, "action");
@@ -198,11 +198,11 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- bp= lt->editlatt->latt->def;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ bp = lt->editlatt->latt->def;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
while (a--) {
- if (bp->hide==0) {
+ if (bp->hide == 0) {
if (bp->f1) {
action = SEL_DESELECT;
break;
@@ -213,26 +213,26 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
}
switch (action) {
- case SEL_SELECT:
- ED_setflagsLatt(obedit, 1);
- break;
- case SEL_DESELECT:
- ED_setflagsLatt(obedit, 0);
- break;
- case SEL_INVERT:
- bp= lt->editlatt->latt->def;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
-
- while (a--) {
- if (bp->hide==0) {
- bp->f1 ^= 1;
+ case SEL_SELECT:
+ ED_setflagsLatt(obedit, 1);
+ break;
+ case SEL_DESELECT:
+ ED_setflagsLatt(obedit, 0);
+ break;
+ case SEL_INVERT:
+ bp = lt->editlatt->latt->def;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+
+ while (a--) {
+ if (bp->hide == 0) {
+ bp->f1 ^= 1;
+ }
+ bp++;
}
- bp++;
- }
- break;
+ break;
}
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -249,7 +249,7 @@ void LATTICE_OT_select_all(wmOperatorType *ot)
ot->poll = ED_operator_editlattice;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -260,27 +260,27 @@ static int make_regular_poll(bContext *C)
if (ED_operator_editlattice(C)) return 1;
- ob= CTX_data_active_object(C);
- return (ob && ob->type==OB_LATTICE);
+ ob = CTX_data_active_object(C);
+ return (ob && ob->type == OB_LATTICE);
}
static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_edit_object(C);
+ Object *ob = CTX_data_edit_object(C);
Lattice *lt;
if (ob) {
- lt= ob->data;
+ lt = ob->data;
resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
}
else {
- ob= CTX_data_active_object(C);
- lt= ob->data;
+ ob = CTX_data_active_object(C);
+ lt = ob->data;
resizelattice(lt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -297,7 +297,7 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
ot->poll = make_regular_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/****************************** Mouse Selection *************************/
@@ -305,12 +305,12 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, int y)
{
struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData;
- float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
+ float temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
- if ((bp->f1 & SELECT)==data->select)
+ if ((bp->f1 & SELECT) == data->select)
temp += 5;
- if (temp<data->dist) {
+ if (temp < data->dist) {
data->dist = temp;
data->bp = bp;
@@ -319,15 +319,15 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in
static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
{
- /* sel==1: selected gets a disadvantage */
- /* in nurb and bezt or bp the nearest is written */
- /* return 0 1 2: handlepunt */
+ /* sel==1: selected gets a disadvantage */
+ /* in nurb and bezt or bp the nearest is written */
+ /* return 0 1 2: handlepunt */
struct { BPoint *bp; short dist, select; int mval[2]; } data = {NULL};
data.dist = 100;
data.select = sel;
- data.mval[0]= mval[0];
- data.mval[1]= mval[1];
+ data.mval[0] = mval[0];
+ data.mval[1] = mval[1];
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
lattice_foreachScreenVert(vc, findnearestLattvert__doClosest, &data);
@@ -338,20 +338,20 @@ static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
int mouse_lattice(bContext *C, const int mval[2], int extend)
{
ViewContext vc;
- BPoint *bp= NULL;
+ BPoint *bp = NULL;
view3d_set_viewcontext(C, &vc);
- bp= findnearestLattvert(&vc, mval, 1);
+ bp = findnearestLattvert(&vc, mval, 1);
if (bp) {
- if (extend==0) {
+ if (extend == 0) {
ED_setflagsLatt(vc.obedit, 0);
bp->f1 |= SELECT;
}
else
- bp->f1 ^= SELECT; /* swap */
+ bp->f1 ^= SELECT; /* swap */
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
return 1;
}
@@ -368,29 +368,29 @@ typedef struct UndoLattice {
static void undoLatt_to_editLatt(void *data, void *edata, void *UNUSED(obdata))
{
- UndoLattice *ult= (UndoLattice*)data;
- EditLatt *editlatt= (EditLatt *)edata;
- int a= editlatt->latt->pntsu*editlatt->latt->pntsv*editlatt->latt->pntsw;
+ UndoLattice *ult = (UndoLattice *)data;
+ EditLatt *editlatt = (EditLatt *)edata;
+ int a = editlatt->latt->pntsu * editlatt->latt->pntsv * editlatt->latt->pntsw;
- memcpy(editlatt->latt->def, ult->def, a*sizeof(BPoint));
+ memcpy(editlatt->latt->def, ult->def, a * sizeof(BPoint));
}
static void *editLatt_to_undoLatt(void *edata, void *UNUSED(obdata))
{
- UndoLattice *ult= MEM_callocN(sizeof(UndoLattice), "UndoLattice");
- EditLatt *editlatt= (EditLatt *)edata;
+ UndoLattice *ult = MEM_callocN(sizeof(UndoLattice), "UndoLattice");
+ EditLatt *editlatt = (EditLatt *)edata;
- ult->def= MEM_dupallocN(editlatt->latt->def);
- ult->pntsu= editlatt->latt->pntsu;
- ult->pntsv= editlatt->latt->pntsv;
- ult->pntsw= editlatt->latt->pntsw;
+ ult->def = MEM_dupallocN(editlatt->latt->def);
+ ult->pntsu = editlatt->latt->pntsu;
+ ult->pntsv = editlatt->latt->pntsv;
+ ult->pntsw = editlatt->latt->pntsw;
return ult;
}
static void free_undoLatt(void *data)
{
- UndoLattice *ult= (UndoLattice*)data;
+ UndoLattice *ult = (UndoLattice *)data;
if (ult->def) MEM_freeN(ult->def);
MEM_freeN(ult);
@@ -398,20 +398,20 @@ static void free_undoLatt(void *data)
static int validate_undoLatt(void *data, void *edata)
{
- UndoLattice *ult= (UndoLattice*)data;
- EditLatt *editlatt= (EditLatt *)edata;
+ UndoLattice *ult = (UndoLattice *)data;
+ EditLatt *editlatt = (EditLatt *)edata;
return (ult->pntsu == editlatt->latt->pntsu &&
- ult->pntsv == editlatt->latt->pntsv &&
- ult->pntsw == editlatt->latt->pntsw);
+ ult->pntsv == editlatt->latt->pntsv &&
+ ult->pntsw == editlatt->latt->pntsw);
}
static void *get_editlatt(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_LATTICE) {
- Lattice *lt= obedit->data;
+ if (obedit && obedit->type == OB_LATTICE) {
+ Lattice *lt = obedit->data;
return lt->editlatt;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index cd2fa4f93b6..f2d682cd0cb 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -87,16 +87,16 @@
ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type)
{
- ModifierData *md=NULL, *new_md=NULL;
+ ModifierData *md = NULL, *new_md = NULL;
ModifierTypeInfo *mti = modifierType_getInfo(type);
/* only geometry objects should be able to get modifiers [#25291] */
if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
- BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name+2);
+ BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name + 2);
return NULL;
}
- if (mti->flags&eModifierTypeFlag_Single) {
+ if (mti->flags & eModifierTypeFlag_Single) {
if (modifiers_findByType(ob, type)) {
BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed");
return NULL;
@@ -111,12 +111,12 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
}
else {
/* get new modifier data to add */
- new_md= modifier_new(type);
+ new_md = modifier_new(type);
- if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+ if (mti->flags & eModifierTypeFlag_RequiresOriginalData) {
md = ob->modifiers.first;
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
+ while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
md = md->next;
BLI_insertlinkbefore(&ob->modifiers, md, new_md);
@@ -134,15 +134,15 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
/* special cases */
if (type == eModifierType_Softbody) {
if (!ob->soft) {
- ob->soft= sbNew(scene);
- ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
+ ob->soft = sbNew(scene);
+ ob->softflag |= OB_SB_GOAL | OB_SB_EDGES;
}
}
else if (type == eModifierType_Collision) {
if (!ob->pd)
- ob->pd= object_add_collision_fields(0);
+ ob->pd = object_add_collision_fields(0);
- ob->pd->deflect= 1;
+ ob->pd->deflect = 1;
DAG_scene_sort(bmain, scene);
}
else if (type == eModifierType_Surface)
@@ -164,8 +164,8 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
/* It seems on rapid delete it is possible to
* get called twice on same modifier, so make
* sure it is in list. */
- for (obmd=ob->modifiers.first; obmd; obmd=obmd->next)
- if (obmd==md)
+ for (obmd = ob->modifiers.first; obmd; obmd = obmd->next)
+ if (obmd == md)
break;
if (!obmd)
@@ -173,22 +173,22 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
/* special cases */
if (md->type == eModifierType_ParticleSystem) {
- ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md;
+ ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
BLI_remlink(&ob->particlesystem, psmd->psys);
psys_free(ob, psmd->psys);
- psmd->psys= NULL;
+ psmd->psys = NULL;
}
else if (md->type == eModifierType_Softbody) {
if (ob->soft) {
sbFree(ob->soft);
- ob->soft= NULL;
- ob->softflag= 0;
+ ob->soft = NULL;
+ ob->softflag = 0;
}
}
else if (md->type == eModifierType_Collision) {
if (ob->pd)
- ob->pd->deflect= 0;
+ ob->pd->deflect = 0;
*sort_depsgraph = 1;
}
@@ -202,13 +202,13 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
ob->dt = OB_TEXTURE;
}
else if (md->type == eModifierType_Multires) {
- int ok= 1;
+ int ok = 1;
ModifierData *tmpmd;
/* ensure MDISPS CustomData layer isn't used by another multires modifiers */
- for (tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next)
- if (tmpmd!=md && tmpmd->type == eModifierType_Multires) {
- ok= 0;
+ for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next)
+ if (tmpmd != md && tmpmd->type == eModifierType_Multires) {
+ ok = 0;
break;
}
@@ -218,7 +218,7 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
}
if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
- ob->particlesystem.first == NULL) {
+ ob->particlesystem.first == NULL) {
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}
@@ -233,7 +233,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
int sort_depsgraph = 0;
int ok;
- ok= object_modifier_remove(ob, md, &sort_depsgraph);
+ ok = object_modifier_remove(ob, md, &sort_depsgraph);
if (!ok) {
BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
@@ -260,11 +260,11 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
while (md) {
ModifierData *next_md;
- next_md= md->next;
+ next_md = md->next;
object_modifier_remove(ob, md, &sort_depsgraph);
- md= next_md;
+ md = next_md;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -279,10 +279,10 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
if (md->prev) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if (mti->type!=eModifierTypeType_OnlyDeform) {
+ if (mti->type != eModifierTypeType_OnlyDeform) {
ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type);
- if (nmti->flags&eModifierTypeFlag_RequiresOriginalData) {
+ if (nmti->flags & eModifierTypeFlag_RequiresOriginalData) {
BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data");
return 0;
}
@@ -300,10 +300,10 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
if (md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+ if (mti->flags & eModifierTypeFlag_RequiresOriginalData) {
ModifierTypeInfo *nmti = modifierType_getInfo(md->next->type);
- if (nmti->type!=eModifierTypeType_OnlyDeform) {
+ if (nmti->type != eModifierTypeType_OnlyDeform) {
BKE_report(reports, RPT_WARNING, "Cannot move beyond a non-deforming modifier");
return 0;
}
@@ -326,72 +326,72 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
MVert *mvert;
MEdge *medge;
int a, k, kmax;
- int totvert=0, totedge=0, cvert=0;
- int totpart=0, totchild=0;
+ int totvert = 0, totedge = 0, cvert = 0;
+ int totpart = 0, totchild = 0;
if (md->type != eModifierType_ParticleSystem) return 0;
if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
- psys=((ParticleSystemModifierData *)md)->psys;
- part= psys->part;
+ psys = ((ParticleSystemModifierData *)md)->psys;
+ part = psys->part;
if (part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
return 0;
- totpart= psys->totcached;
- totchild= psys->totchildcache;
+ totpart = psys->totcached;
+ totchild = psys->totchildcache;
- if (totchild && (part->draw&PART_DRAW_PARENT)==0)
- totpart= 0;
+ if (totchild && (part->draw & PART_DRAW_PARENT) == 0)
+ totpart = 0;
/* count */
- cache= psys->pathcache;
- for (a=0; a<totpart; a++) {
- key= cache[a];
+ cache = psys->pathcache;
+ for (a = 0; a < totpart; a++) {
+ key = cache[a];
if (key->steps > 0) {
- totvert+= key->steps+1;
- totedge+= key->steps;
+ totvert += key->steps + 1;
+ totedge += key->steps;
}
}
- cache= psys->childcache;
- for (a=0; a<totchild; a++) {
- key= cache[a];
+ cache = psys->childcache;
+ for (a = 0; a < totchild; a++) {
+ key = cache[a];
if (key->steps > 0) {
- totvert+= key->steps+1;
- totedge+= key->steps;
+ totvert += key->steps + 1;
+ totedge += key->steps;
}
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
/* add new mesh */
- obn= add_object(scene, OB_MESH);
- me= obn->data;
+ obn = add_object(scene, OB_MESH);
+ me = obn->data;
- me->totvert= totvert;
- me->totedge= totedge;
+ me->totvert = totvert;
+ me->totedge = totedge;
- me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
- me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
- me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
+ me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
+ me->medge = CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
+ me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
- mvert= me->mvert;
- medge= me->medge;
+ mvert = me->mvert;
+ medge = me->medge;
/* copy coordinates */
- cache= psys->pathcache;
- for (a=0; a<totpart; a++) {
- key= cache[a];
- kmax= key->steps;
- for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- copy_v3_v3(mvert->co,key->co);
+ cache = psys->pathcache;
+ for (a = 0; a < totpart; a++) {
+ key = cache[a];
+ kmax = key->steps;
+ for (k = 0; k <= kmax; k++, key++, cvert++, mvert++) {
+ copy_v3_v3(mvert->co, key->co);
if (k) {
- medge->v1= cvert-1;
- medge->v2= cvert;
- medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
+ medge->v1 = cvert - 1;
+ medge->v2 = cvert;
+ medge->flag = ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
medge++;
}
else {
@@ -401,16 +401,16 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
}
}
- cache=psys->childcache;
- for (a=0; a<totchild; a++) {
- key=cache[a];
- kmax=key->steps;
- for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- copy_v3_v3(mvert->co,key->co);
+ cache = psys->childcache;
+ for (a = 0; a < totchild; a++) {
+ key = cache[a];
+ kmax = key->steps;
+ for (k = 0; k <= kmax; k++, key++, cvert++, mvert++) {
+ copy_v3_v3(mvert->co, key->co);
if (k) {
- medge->v1=cvert-1;
- medge->v2=cvert;
- medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
+ medge->v1 = cvert - 1;
+ medge->v2 = cvert;
+ medge->flag = ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
medge++;
}
else {
@@ -427,9 +427,9 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
{
- ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene= scene;
+ md->scene = scene;
if (mti->isDisabled && mti->isDisabled(md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
@@ -447,10 +447,10 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
* and then predominantly stated in comments in a half dozen headers.
*/
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
DerivedMesh *dm;
- Mesh *me= ob->data;
- Key *key=me->key;
+ Mesh *me = ob->data;
+ Key *key = me->key;
KeyBlock *kb;
if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
@@ -465,15 +465,15 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
}
if (key == NULL) {
- key= me->key= add_key((ID *)me);
- key->type= KEY_RELATIVE;
+ key = me->key = add_key((ID *)me);
+ key->type = KEY_RELATIVE;
/* if that was the first key block added, then it was the basis.
* Initialize it with the mesh, and add another for the modifier */
- kb= add_keyblock(key, NULL);
+ kb = add_keyblock(key, NULL);
mesh_to_key(me, kb);
}
- kb= add_keyblock(key, md->name);
+ kb = add_keyblock(key, md->name);
DM_to_meshkey(dm, me, kb);
dm->release(dm);
@@ -487,19 +487,19 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
{
- ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene= scene;
+ md->scene = scene;
if (mti->isDisabled && mti->isDisabled(md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
return 0;
}
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
DerivedMesh *dm;
Mesh *me = ob->data;
- MultiresModifierData *mmd= find_multires_modifier_before(scene, md);
+ MultiresModifierData *mmd = find_multires_modifier_before(scene, md);
if (me->key && mti->type != eModifierTypeType_NonGeometrical) {
BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
@@ -510,8 +510,8 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
if (md->type == eModifierType_Multires)
multires_force_update(ob);
- if (mmd && mmd->totlvl && mti->type==eModifierTypeType_OnlyDeform) {
- if (!multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md)) {
+ if (mmd && mmd->totlvl && mti->type == eModifierTypeType_OnlyDeform) {
+ if (!multiresModifier_reshapeFromDeformMod(scene, mmd, ob, md)) {
BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
return 0;
}
@@ -544,9 +544,9 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
cu = ob->data;
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
- vertexCos = curve_getVertexCos(cu, &cu->nurb, &numVerts);
+ vertexCos = BKE_curve_vertexCos_get(cu, &cu->nurb, &numVerts);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
- curve_applyVertexCos(cu, &cu->nurb, vertexCos);
+ BK_curve_vertexCos_apply(cu, &cu->nurb, vertexCos);
MEM_freeN(vertexCos);
@@ -562,7 +562,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
ParticleSystem *psys = ob->particlesystem.first;
- for (; psys; psys=psys->next) {
+ for (; psys; psys = psys->next) {
if (psys->part->type != PART_HAIR)
continue;
@@ -582,27 +582,27 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in editmode");
return 0;
}
- else if (((ID*) ob->data)->us>1) {
+ else if (((ID *) ob->data)->us > 1) {
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
return 0;
}
- if (md!=ob->modifiers.first)
+ if (md != ob->modifiers.first)
BKE_report(reports, RPT_INFO, "Applied modifier was not first, result may not be as expected");
/* allow apply of a not-realtime modifier, by first re-enabling realtime. */
- prev_mode= md->mode;
+ prev_mode = md->mode;
md->mode |= eModifierMode_Realtime;
if (mode == MODIFIER_APPLY_SHAPE) {
if (!modifier_apply_shape(reports, scene, ob, md)) {
- md->mode= prev_mode;
+ md->mode = prev_mode;
return 0;
}
}
else {
if (!modifier_apply_obdata(reports, scene, ob, md)) {
- md->mode= prev_mode;
+ md->mode = prev_mode;
return 0;
}
}
@@ -629,34 +629,34 @@ int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierDat
static int modifier_add_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
if (!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob= ED_object_active_context(C);
- EnumPropertyItem *item= NULL, *md_item, *group_item= NULL;
+ Object *ob = ED_object_active_context(C);
+ EnumPropertyItem *item = NULL, *md_item, *group_item = NULL;
ModifierTypeInfo *mti;
- int totitem= 0, a;
+ int totitem = 0, a;
if (!ob)
return modifier_type_items;
- for (a=0; modifier_type_items[a].identifier; a++) {
- md_item= &modifier_type_items[a];
+ for (a = 0; modifier_type_items[a].identifier; a++) {
+ md_item = &modifier_type_items[a];
if (md_item->identifier[0]) {
- mti= modifierType_getInfo(md_item->value);
+ mti = modifierType_getInfo(md_item->value);
if (mti->flags & eModifierTypeFlag_NoUserAdd)
continue;
@@ -665,22 +665,22 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
continue;
}
else {
- group_item= md_item;
- md_item= NULL;
+ group_item = md_item;
+ md_item = NULL;
continue;
}
if (group_item) {
RNA_enum_item_add(&item, &totitem, group_item);
- group_item= NULL;
+ group_item = NULL;
}
RNA_enum_item_add(&item, &totitem, md_item);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -700,10 +700,10 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "type", modifier_type_items, eModifierType_Subsurf, "Type", "");
+ prop = RNA_def_enum(ot->srna, "type", modifier_type_items, eModifierType_Subsurf, "Type", "");
RNA_def_enum_funcs(prop, modifier_add_itemf);
ot->prop = prop;
}
@@ -712,12 +712,12 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
static int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", rna_type);
- Object *ob= (ptr.id.data)?ptr.id.data:ED_object_active_context(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
+ Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
if (!ob || ob->id.lib) return 0;
- if (obtype_flag && ((1<<ob->type) & obtype_flag)==0) return 0;
- if (ptr.id.data && ((ID*)ptr.id.data)->lib) return 0;
+ if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) return 0;
+ if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0;
return 1;
}
@@ -734,7 +734,7 @@ static void edit_modifier_properties(wmOperatorType *ot)
static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
ModifierData *md;
if (RNA_struct_property_is_set(op->ptr, "modifier"))
@@ -767,8 +767,8 @@ static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int
static int modifier_remove_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int mode_orig = ob ? ob->mode : 0;
@@ -776,13 +776,13 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
/* if cloth/softbody was removed, particle mode could be cleared */
if (mode_orig & OB_MODE_PARTICLE_EDIT)
- if ((ob->mode & OB_MODE_PARTICLE_EDIT)==0)
- if (scene->basact && scene->basact->object==ob)
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
+ if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0)
+ if (scene->basact && scene->basact->object == ob)
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
return OPERATOR_FINISHED;
}
@@ -806,7 +806,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -821,7 +821,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -845,7 +845,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -860,7 +860,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -884,7 +884,7 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -892,17 +892,17 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
static int modifier_apply_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- int apply_as= RNA_enum_get(op->ptr, "apply_as");
+ int apply_as = RNA_enum_get(op->ptr, "apply_as");
if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -931,7 +931,7 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "apply_as", modifier_apply_as_items, MODIFIER_APPLY_DATA, "Apply as", "How to apply the modifier to the geometry");
edit_modifier_properties(ot);
@@ -941,8 +941,8 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
static int modifier_convert_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
@@ -950,7 +950,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -974,7 +974,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -989,7 +989,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1013,7 +1013,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1021,7 +1021,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
static int multires_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1<<OB_MESH));
+ return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH));
}
static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
@@ -1034,7 +1034,7 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
multiresModifier_del_levels(mmd, ob, 1);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1058,7 +1058,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
ot->exec = multires_higher_levels_delete_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1075,7 +1075,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
multiresModifier_subdivide(mmd, ob, 0, mmd->simple);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1099,7 +1099,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
ot->exec = multires_subdivide_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1107,21 +1107,21 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
static int multires_reshape_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_active_context(C), *secondob= NULL;
- Scene *scene= CTX_data_scene(C);
+ Object *ob = ED_object_active_context(C), *secondob = NULL;
+ Scene *scene = CTX_data_scene(C);
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
- if (mmd->lvl==0) {
+ if (mmd->lvl == 0) {
BKE_report(op->reports, RPT_ERROR, "Reshape can work only with higher levels of subdivisions");
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Object*, selob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, selob, selected_editable_objects) {
if (selob->type == OB_MESH && selob != ob) {
- secondob= selob;
+ secondob = selob;
break;
}
}
@@ -1138,7 +1138,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1162,7 +1162,7 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
ot->exec = multires_reshape_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1173,9 +1173,9 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
static int multires_external_save_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- Mesh *me= (ob)? ob->data: op->customdata;
+ Mesh *me = (ob) ? ob->data : op->customdata;
char path[FILE_MAX];
- int relative= RNA_boolean_get(op->ptr, "relative_path");
+ int relative = RNA_boolean_get(op->ptr, "relative_path");
if (!me)
return OPERATOR_CANCELLED;
@@ -1198,7 +1198,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
{
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd;
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
char path[FILE_MAX];
if (!edit_modifier_invoke_properties(C, op))
@@ -1215,9 +1215,9 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
if (RNA_struct_property_is_set(op->ptr, "filepath"))
return multires_external_save_exec(C, op);
- op->customdata= me;
+ op->customdata = me;
- BLI_snprintf(path, sizeof(path), "//%s.btx", me->id.name+2);
+ BLI_snprintf(path, sizeof(path), "//%s.btx", me->id.name + 2);
RNA_string_set(op->ptr, "filepath", path);
WM_event_add_fileselect(C, op);
@@ -1237,9 +1237,9 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
ot->poll = multires_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
edit_modifier_properties(ot);
}
@@ -1248,7 +1248,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_active_context(C);
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (!CustomData_external_test(&me->ldata, CD_MDISPS))
return OPERATOR_CANCELLED;
@@ -1269,7 +1269,7 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
ot->exec = multires_external_pack_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************* multires apply base ***********************/
@@ -1284,7 +1284,7 @@ static int multires_base_apply_exec(bContext *C, wmOperator *op)
multiresModifier_base_apply(mmd, ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1309,7 +1309,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
ot->exec = multires_base_apply_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1318,12 +1318,12 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
static int meshdeform_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, (1<<OB_MESH));
+ return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, (1 << OB_MESH));
}
static int meshdeform_bind_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform);
@@ -1337,47 +1337,48 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
if (mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
if (mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
if (mmd->dynverts) MEM_freeN(mmd->dynverts);
- if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
- if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
-
- mmd->bindcagecos= NULL;
- mmd->dyngrid= NULL;
- mmd->dyninfluences= NULL;
- mmd->bindoffsets= NULL;
- mmd->dynverts= NULL;
- mmd->bindweights= NULL; /* deprecated */
- mmd->bindcos= NULL; /* deprecated */
- mmd->totvert= 0;
- mmd->totcagevert= 0;
- mmd->totinfluence= 0;
+ if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
+ if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
+
+ mmd->bindcagecos = NULL;
+ mmd->dyngrid = NULL;
+ mmd->dyninfluences = NULL;
+ mmd->bindinfluences = NULL;
+ mmd->bindoffsets = NULL;
+ mmd->dynverts = NULL;
+ mmd->bindweights = NULL; /* deprecated */
+ mmd->bindcos = NULL; /* deprecated */
+ mmd->totvert = 0;
+ mmd->totcagevert = 0;
+ mmd->totinfluence = 0;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
}
else {
DerivedMesh *dm;
- int mode= mmd->modifier.mode;
+ int mode = mmd->modifier.mode;
/* force modifier to run, it will call binding routine */
- mmd->bindfunc= mesh_deform_bind;
+ mmd->bindfunc = mesh_deform_bind;
mmd->modifier.mode |= eModifierMode_Realtime;
if (ob->type == OB_MESH) {
- dm= mesh_create_derived_view(scene, ob, 0);
+ dm = mesh_create_derived_view(scene, ob, 0);
dm->release(dm);
}
else if (ob->type == OB_LATTICE) {
lattice_calc_modifiers(scene, ob);
}
- else if (ob->type==OB_MBALL) {
+ else if (ob->type == OB_MBALL) {
makeDispListMBall(scene, ob);
}
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
makeDispListCurveTypes(scene, ob, 0);
}
- mmd->bindfunc= NULL;
- mmd->modifier.mode= mode;
+ mmd->bindfunc = NULL;
+ mmd->modifier.mode = mode;
}
return OPERATOR_FINISHED;
@@ -1404,7 +1405,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
ot->exec = meshdeform_bind_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1426,7 +1427,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op)
emd->flag |= eExplodeFlag_CalcFaces;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1451,7 +1452,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot)
ot->exec = explode_refresh_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1475,11 +1476,11 @@ static void init_ocean_modifier_bake(struct Ocean *oc, struct OceanModifierData
do_normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS);
do_jacobian = (omd->flag & MOD_OCEAN_GENERATE_FOAM);
- BKE_init_ocean(oc, omd->resolution*omd->resolution, omd->resolution*omd->resolution, omd->spatial_size, omd->spatial_size,
- omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment,
- omd->depth, omd->time,
- do_heightfield, do_chop, do_normals, do_jacobian,
- omd->seed);
+ BKE_init_ocean(oc, omd->resolution * omd->resolution, omd->resolution * omd->resolution, omd->spatial_size, omd->spatial_size,
+ omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment,
+ omd->depth, omd->time,
+ do_heightfield, do_chop, do_normals, do_jacobian,
+ omd->seed);
}
typedef struct OceanBakeJob {
@@ -1495,7 +1496,7 @@ typedef struct OceanBakeJob {
static void oceanbake_free(void *customdata)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
MEM_freeN(oj);
}
@@ -1514,34 +1515,34 @@ static int oceanbake_breakjob(void *UNUSED(customdata))
/* called by oceanbake, wmJob sends notifier */
static void oceanbake_update(void *customdata, float progress, int *cancel)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
if (oceanbake_breakjob(oj))
*cancel = 1;
- *(oj->do_update)= 1;
- *(oj->progress)= progress;
+ *(oj->do_update) = 1;
+ *(oj->progress) = progress;
}
static void oceanbake_startjob(void *customdata, short *stop, short *do_update, float *progress)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
- oj->stop= stop;
+ oj->stop = stop;
oj->do_update = do_update;
oj->progress = progress;
- G.afbreek= 0; /* XXX shared with render - replace with job 'stop' switch */
+ G.afbreek = 0; /* XXX shared with render - replace with job 'stop' switch */
BKE_bake_ocean(oj->ocean, oj->och, oceanbake_update, (void *)oj);
- *do_update= 1;
+ *do_update = 1;
*stop = 0;
}
static void oceanbake_endjob(void *customdata)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
if (oj->ocean) {
BKE_free_ocean(oj->ocean);
@@ -1559,8 +1560,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
OceanCache *och;
struct Ocean *ocean;
- int f, cfra, i=0;
- int free= RNA_boolean_get(op->ptr, "free");
+ int f, cfra, i = 0;
+ int free = RNA_boolean_get(op->ptr, "free");
wmJob *steve;
OceanBakeJob *oj;
@@ -1571,7 +1572,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
if (free) {
omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1579,12 +1580,12 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
omd->bakestart, omd->bakeend, omd->wave_scale,
omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
- och->time = MEM_mallocN(och->duration*sizeof(float), "foam bake time");
+ och->time = MEM_mallocN(och->duration * sizeof(float), "foam bake time");
cfra = scene->r.cfra;
/* precalculate time variable before baking */
- for (f=omd->bakestart; f<=omd->bakeend; f++) {
+ for (f = omd->bakestart; f <= omd->bakeend; f++) {
/* from physics_fluid.c:
*
* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
@@ -1613,7 +1614,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
init_ocean_modifier_bake(ocean, omd);
#if 0
- BKE_bake_ocean(ocean, och);
+ BKE_bake_ocean(ocean, och);
omd->oceancache = och;
omd->cached = TRUE;
@@ -1621,7 +1622,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
scene->r.cfra = cfra;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
#endif
/* job stuff */
@@ -1629,14 +1630,14 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
scene->r.cfra = cfra;
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
- oj= MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
+ oj = MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
oj->ocean = ocean;
oj->och = och;
oj->omd = omd;
WM_jobs_customdata(steve, oj, oceanbake_free);
- WM_jobs_timer(steve, 0.1, NC_OBJECT|ND_MODIFIER, NC_OBJECT|ND_MODIFIER);
+ WM_jobs_timer(steve, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
WM_jobs_callbacks(steve, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
WM_jobs_start(CTX_wm_manager(C), steve);
@@ -1666,7 +1667,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
ot->exec = ocean_bake_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it");
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 43385ea80a3..72f23177946 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -223,7 +223,7 @@ void ED_operatormacros_object(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
ot->description = "Duplicate selected objects and move them";
WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
@@ -232,7 +232,7 @@ void ED_operatormacros_object(void)
}
/* grr, should be able to pass options on... */
- ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
ot->description = "Duplicate selected objects and move them";
otmacro = WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
@@ -242,10 +242,10 @@ void ED_operatormacros_object(void)
}
/* XXX */
- ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
ot->description = "Add named object at cursor";
- RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
+ RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME - 2, "Name", "Object name to add");
WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d");
WM_operatortype_macro_define(ot, "OBJECT_OT_add_named");
@@ -254,7 +254,7 @@ void ED_operatormacros_object(void)
static int object_mode_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
return (!ob || ob->mode == OB_MODE_OBJECT);
}
@@ -284,7 +284,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "mode", OB_MODE_WEIGHT_PAINT);
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
- WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_CTRL, 0);
/* Object Mode ---------------------------------------------------------------- */
/* Note: this keymap gets disabled in non-objectmode, */
@@ -303,7 +303,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set_identifier(kmi->ptr, "direction", "PARENT");
@@ -322,13 +322,13 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "extend", TRUE);
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_track_set", TKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_track_clear", TKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+ WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_location_clear", GKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_rotation_clear", RKEY, KM_PRESS, KM_ALT, 0);
@@ -343,13 +343,13 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
/* same as above but for rendering */
- WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_clear", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_clear", HKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_CTRL, 0);
/* conflicts, removing */
#if 0
- kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)
- RNA_boolean_set(kmi->ptr, "unselected", TRUE);
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)
+ RNA_boolean_set(kmi->ptr, "unselected", TRUE);
#endif
WM_keymap_add_item(keymap, "OBJECT_OT_move_to_layer", MKEY, KM_PRESS, 0, 0);
@@ -367,7 +367,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_apply", AKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_make_single_user", UKEY, KM_PRESS, 0, 0);
@@ -378,23 +378,23 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0);
// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_create", GKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
- WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
- for (i=0; i<=5; i++) {
- kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0);
+ for (i = 0; i <= 5; i++) {
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0);
RNA_int_set(kmi->ptr, "level", i);
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index a666f04034b..751cd751224 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -110,9 +110,9 @@ static int vertex_parent_set_poll(bContext *C)
static int vertex_parent_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
BMVert *eve;
BMIter iter;
Curve *cu;
@@ -120,18 +120,18 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BezTriple *bezt;
BPoint *bp;
Object *par;
- int a, v1=0, v2=0, v3=0, v4=0, nr=1;
+ int a, v1 = 0, v2 = 0, v3 = 0, v4 = 0, nr = 1;
/* we need 1 to 3 selected vertices */
- if (obedit->type==OB_MESH) {
- Mesh *me= obedit->data;
+ if (obedit->type == OB_MESH) {
+ Mesh *me = obedit->data;
BMEditMesh *em;
EDBM_mesh_load(obedit);
EDBM_mesh_make(scene->toolsettings, scene, obedit);
- em= me->edit_btmesh;
+ em = me->edit_btmesh;
/* derivedMesh might be needed for solving parenting,
* so re-create it here */
@@ -139,31 +139,31 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
}
}
else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
- ListBase *editnurb= object_editcurve_get(obedit);
+ ListBase *editnurb = object_editcurve_get(obedit);
- cu= obedit->data;
+ cu = obedit->data;
- nu= editnurb->first;
+ nu = editnurb->first;
while (nu) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
@@ -171,34 +171,34 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
bp++;
}
}
- nu= nu->next;
+ nu = nu->next;
}
}
- else if (obedit->type==OB_LATTICE) {
- Lattice *lt= obedit->data;
+ else if (obedit->type == OB_LATTICE) {
+ Lattice *lt = obedit->data;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
- bp= lt->editlatt->latt->def;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+ bp = lt->editlatt->latt->def;
while (a--) {
if (bp->f1 & SELECT) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
@@ -206,19 +206,19 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
- if (v4 || !((v1 && v2==0 && v3==0) || (v1 && v2 && v3)) ) {
+ if (v4 || !((v1 && v2 == 0 && v3 == 0) || (v1 && v2 && v3)) ) {
BKE_report(op->reports, RPT_ERROR, "Select either 1 or 3 vertices to parent to");
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob != obedit) {
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- par= obedit->parent;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ par = obedit->parent;
while (par) {
- if (par==ob) break;
- par= par->parent;
+ if (par == ob) break;
+ par = par->parent;
}
if (par) {
BKE_report(op->reports, RPT_ERROR, "Loop in parents");
@@ -226,20 +226,20 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
else {
Object workob;
- ob->parent= BASACT->object;
+ ob->parent = BASACT->object;
if (v3) {
- ob->partype= PARVERT3;
- ob->par1= v1-1;
- ob->par2= v2-1;
- ob->par3= v3-1;
+ ob->partype = PARVERT3;
+ ob->par1 = v1 - 1;
+ ob->par2 = v2 - 1;
+ ob->par3 = v3 - 1;
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
- ob->partype= PARVERT1;
- ob->par1= v1-1;
+ ob->partype = PARVERT1;
+ ob->par1 = v1 - 1;
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
@@ -270,16 +270,16 @@ void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
ot->exec = vertex_parent_set_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** Make Proxy Operator *************************/
/* set the object to proxify */
-static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int make_proxy_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_active_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_active_context(C);
/* sanity checks */
if (!scene || scene->id.lib || !ob)
@@ -294,8 +294,8 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
}
else if (ob->id.lib) {
- uiPopupMenu *pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION);
- uiLayout *layout= uiPupMenuLayout(pup);
+ uiPopupMenu *pup = uiPupMenuBegin(C, "OK?", ICON_QUESTION);
+ uiLayout *layout = uiPupMenuLayout(pup);
/* create operator menu item with relevant properties filled in */
uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
@@ -312,41 +312,41 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
return OPERATOR_CANCELLED;
}
-static int make_proxy_exec (bContext *C, wmOperator *op)
+static int make_proxy_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Object *ob, *gob= ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
+ Object *ob, *gob = ED_object_active_context(C);
GroupObject *go;
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
if (gob->dup_group != NULL) {
- go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object"));
- ob= go->ob;
+ go = BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object"));
+ ob = go->ob;
}
else {
- ob= gob;
+ ob = gob;
gob = NULL;
}
if (ob) {
Object *newob;
- Base *newbase, *oldbase= BASACT;
- char name[MAX_ID_NAME+4];
+ Base *newbase, *oldbase = BASACT;
+ char name[MAX_ID_NAME + 4];
/* Add new object for the proxy */
- newob= add_object(scene, OB_EMPTY);
+ newob = add_object(scene, OB_EMPTY);
- BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name+2);
+ BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
rename_id(&newob->id, name);
/* set layers OK */
- newbase= BASACT; /* add_object sets active... */
- newbase->lay= oldbase->lay;
- newob->lay= newbase->lay;
+ newbase = BASACT; /* add_object sets active... */
+ newbase->lay = oldbase->lay;
+ newob->lay = newbase->lay;
/* remove base, leave user count of object, it gets linked in object_make_proxy */
- if (gob==NULL) {
+ if (gob == NULL) {
BLI_remlink(&scene->base, oldbase);
MEM_freeN(oldbase);
}
@@ -355,8 +355,8 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* depsgraph flushes are needed for the new data */
DAG_scene_sort(bmain, scene);
- DAG_id_tag_update(&newob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob);
+ DAG_id_tag_update(&newob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, newob);
}
else {
BKE_report(op->reports, RPT_ERROR, "No object to make proxy for");
@@ -369,29 +369,29 @@ 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 *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- EnumPropertyItem item_tmp= {0}, *item= NULL;
- int totitem= 0;
- int i= 0;
- Object *ob= ED_object_active_context(C);
+ EnumPropertyItem item_tmp = {0}, *item = NULL;
+ int totitem = 0;
+ int i = 0;
+ Object *ob = ED_object_active_context(C);
GroupObject *go;
if (!ob || !ob->dup_group)
return DummyRNA_DEFAULT_items;
/* find the object to affect */
- for (go= ob->dup_group->gobject.first; go; go= go->next) {
- item_tmp.identifier= item_tmp.name= go->ob->id.name+2;
- item_tmp.value= i++;
+ for (go = ob->dup_group->gobject.first; go; go = go->next) {
+ item_tmp.identifier = item_tmp.name = go->ob->id.name + 2;
+ item_tmp.value = i++;
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
-void OBJECT_OT_proxy_make (wmOperatorType *ot)
+void OBJECT_OT_proxy_make(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -406,10 +406,10 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
ot->poll = ED_operator_object_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for"); /* XXX, relies on hard coded ID at the moment */
+ prop = RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for"); /* XXX, relies on hard coded ID at the moment */
RNA_def_enum_funcs(prop, proxy_group_object_itemf);
ot->prop = prop;
}
@@ -425,32 +425,31 @@ EnumPropertyItem prop_clear_parent_types[] = {
void ED_object_parent_clear(bContext *C, int type)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent == NULL)
continue;
if (type == 0) {
- ob->parent= NULL;
+ ob->parent = NULL;
}
else if (type == 1) {
- ob->parent= NULL;
+ ob->parent = NULL;
object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
}
else if (type == 2)
unit_m4(ob->parentinv);
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
}
/* note, poll should check for editable scene */
@@ -475,7 +474,7 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", "");
}
@@ -485,15 +484,15 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
void ED_object_parent(Object *ob, Object *par, int type, const char *substr)
{
if (!par || BKE_object_parent_loop_check(par, ob)) {
- ob->parent= NULL;
- ob->partype= PAROBJECT;
- ob->parsubstr[0]= 0;
+ ob->parent = NULL;
+ ob->partype = PAROBJECT;
+ ob->parsubstr[0] = 0;
return;
}
/* this could use some more checks */
- ob->parent= par;
+ ob->parent = par;
ob->partype &= ~PARTYPE;
ob->partype |= type;
BLI_strncpy(ob->parsubstr, substr, sizeof(ob->parsubstr));
@@ -518,20 +517,20 @@ EnumPropertyItem prop_make_parent_types[] = {
int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par, int partype)
{
- bPoseChannel *pchan= NULL;
- int pararm= ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
+ bPoseChannel *pchan = NULL;
+ int pararm = ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
par->recalc |= OB_RECALC_OB;
/* preconditions */
- if (partype==PAR_FOLLOW || partype==PAR_PATH_CONST) {
- if (par->type!=OB_CURVE)
+ if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) {
+ if (par->type != OB_CURVE)
return 0;
else {
- Curve *cu= par->data;
+ Curve *cu = par->data;
- if ((cu->flag & CU_PATH)==0) {
- cu->flag |= CU_PATH|CU_FOLLOW;
+ if ((cu->flag & CU_PATH) == 0) {
+ cu->flag |= CU_PATH | CU_FOLLOW;
makeDispListCurveTypes(scene, par, 0); /* force creation of path data */
}
else cu->flag |= CU_FOLLOW;
@@ -549,19 +548,19 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* fall back on regular parenting now (for follow only) */
if (partype == PAR_FOLLOW)
- partype= PAR_OBJECT;
+ partype = PAR_OBJECT;
}
}
- else if (partype==PAR_BONE) {
- pchan= get_active_posechannel(par);
+ else if (partype == PAR_BONE) {
+ pchan = get_active_posechannel(par);
- if (pchan==NULL) {
+ if (pchan == NULL) {
BKE_report(reports, RPT_ERROR, "No active Bone");
return 0;
}
}
- if (ob!=par) {
+ if (ob != par) {
if (BKE_object_parent_loop_check(par, ob)) {
BKE_report(reports, RPT_ERROR, "Loop in parents");
return 0;
@@ -574,14 +573,14 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* set the parent (except for follow-path constraint option) */
if (partype != PAR_PATH_CONST) {
- ob->parent= par;
+ ob->parent = par;
}
/* handle types */
if (pchan)
BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
else
- ob->parsubstr[0]= 0;
+ ob->parsubstr[0] = 0;
if (partype == PAR_PATH_CONST) {
/* don't do anything here, since this is not technically "parenting" */
@@ -590,7 +589,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created
* NOTE: the old (2.4x) method was to set ob->partype = PARSKEL, creating the virtual modifiers
*/
- ob->partype= PAROBJECT; /* note, dna define, not operator property */
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
//ob->partype= PARSKEL; /* note, dna define, not operator property */
/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */
@@ -599,25 +598,25 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
ModifierData *md;
switch (partype) {
- case PAR_CURVE: /* curve deform */
- md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
- ((CurveModifierData *)md)->object= par;
- break;
- case PAR_LATTICE: /* lattice deform */
- md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
- ((LatticeModifierData *)md)->object= par;
- break;
- default: /* armature deform */
- md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
- ((ArmatureModifierData *)md)->object= par;
- break;
+ case PAR_CURVE: /* curve deform */
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
+ ((CurveModifierData *)md)->object = par;
+ break;
+ case PAR_LATTICE: /* lattice deform */
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
+ ((LatticeModifierData *)md)->object = par;
+ break;
+ default: /* armature deform */
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
+ ((ArmatureModifierData *)md)->object = par;
+ break;
}
}
}
else if (partype == PAR_BONE)
- ob->partype= PARBONE; /* note, dna define, not operator property */
+ ob->partype = PARBONE; /* note, dna define, not operator property */
else
- ob->partype= PAROBJECT; /* note, dna define, not operator property */
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
/* constraint */
if (partype == PAR_PATH_CONST) {
@@ -637,7 +636,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
ob->loc[1] = vec[1];
ob->loc[2] = vec[2];
}
- else if (pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
+ else if (pararm && ob->type == OB_MESH && par->type == OB_ARMATURE) {
if (partype == PAR_ARMATURE_NAME)
create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_NAME, 0);
else if (partype == PAR_ARMATURE_ENVELOPE)
@@ -648,7 +647,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
WM_cursor_wait(0);
}
/* get corrected inverse */
- ob->partype= PAROBJECT;
+ ob->partype = PAROBJECT;
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
@@ -659,7 +658,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
invert_m4_m4(ob->parentinv, workob.obmat);
}
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
}
}
@@ -668,14 +667,13 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
static int parent_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *par= ED_object_active_context(C);
- int partype= RNA_enum_get(op->ptr, "type");
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *par = ED_object_active_context(C);
+ int partype = RNA_enum_get(op->ptr, "type");
int ok = 1;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
ok = 0;
break;
@@ -688,8 +686,8 @@ static int parent_set_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
return OPERATOR_FINISHED;
}
@@ -697,22 +695,22 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
- Object *ob= ED_object_active_context(C);
- uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
- uiLayout *layout= uiPupMenuLayout(pup);
+ Object *ob = ED_object_active_context(C);
+ uiPopupMenu *pup = uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
+ uiLayout *layout = uiPupMenuLayout(pup);
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_OBJECT);
/* ob becomes parent, make the associated menus */
- if (ob->type==OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_NAME);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_AUTO);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_BONE);
}
- else if (ob->type==OB_CURVE) {
+ else if (ob->type == OB_CURVE) {
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_CURVE);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_FOLLOW);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_PATH_CONST);
@@ -741,7 +739,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
ot->poll = ED_operator_object_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
}
@@ -750,13 +748,13 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
static int parent_noinv_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Object *par= ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
+ Object *par = ED_object_active_context(C);
par->recalc |= OB_RECALC_OB;
/* context iterator */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob != par) {
if (BKE_object_parent_loop_check(par, ob)) {
BKE_report(op->reports, RPT_ERROR, "Loop in parents");
@@ -764,14 +762,14 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
else {
/* clear inverse matrix and also the object location */
unit_m4(ob->parentinv);
- memset(ob->loc, 0, 3*sizeof(float));
+ memset(ob->loc, 0, 3 * sizeof(float));
/* set recalc flags */
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
/* set parenting type for object - object only... */
- ob->parent= par;
- ob->partype= PAROBJECT; /* note, dna define, not operator property */
+ ob->parent = par;
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
}
}
}
@@ -779,7 +777,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, CTX_data_scene(C));
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -797,17 +795,17 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ Clear Slow Parent Operator *********************/
static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent) {
if (ob->partype & PARSLOW) {
ob->partype -= PARSLOW;
@@ -839,17 +837,17 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** Make Slow Parent Operator *********************/
static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent)
ob->partype |= PARSLOW;
@@ -878,7 +876,7 @@ void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Clear Track Operator ******************* */
@@ -892,24 +890,24 @@ static EnumPropertyItem prop_clear_track_types[] = {
/* note, poll should check for editable scene */
static int object_track_clear_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- int type= RNA_enum_get(op->ptr, "type");
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int type = RNA_enum_get(op->ptr, "type");
if (CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
bConstraint *con, *pcon;
/* remove track-object for old track */
- ob->track= NULL;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->track = NULL;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* also remove all tracking constraints */
- for (con= ob->constraints.last; con; con= pcon) {
- pcon= con->prev;
+ for (con = ob->constraints.last; con; con = pcon) {
+ pcon = con->prev;
if (ELEM3(con->type, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_DAMPTRACK))
remove_constraint(&ob->constraints, con);
}
@@ -921,7 +919,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(bmain, 0);
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -940,7 +938,7 @@ void OBJECT_OT_track_clear(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", "");
}
@@ -956,23 +954,23 @@ static EnumPropertyItem prop_make_track_types[] = {
static int track_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *obact= ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obact = ED_object_active_context(C);
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
if (type == 1) {
bConstraint *con;
bDampTrackConstraint *data;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if (ob!=obact) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if (ob != obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER)
@@ -985,13 +983,13 @@ static int track_set_exec(bContext *C, wmOperator *op)
bConstraint *con;
bTrackToConstraint *data;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if (ob!=obact) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if (ob != obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
@@ -1006,13 +1004,13 @@ static int track_set_exec(bContext *C, wmOperator *op)
bConstraint *con;
bLockTrackConstraint *data;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if (ob!=obact) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if (ob != obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
@@ -1026,7 +1024,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -1045,7 +1043,7 @@ void OBJECT_OT_track_set(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", "");
@@ -1056,24 +1054,24 @@ void OBJECT_OT_track_set(wmOperatorType *ot)
static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
{
int values[20], a;
- unsigned int lay= 0;
+ unsigned int lay = 0;
if (!RNA_struct_property_is_set(op->ptr, "layers")) {
/* note: layers are set in bases, library objects work for this */
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
lay |= base->lay;
}
CTX_DATA_END;
- for (a=0; a<20; a++)
- values[a]= (lay & (1<<a));
+ for (a = 0; a < 20; a++)
+ values[a] = (lay & (1 << a));
RNA_boolean_set_array(op->ptr, "layers", values);
}
else {
RNA_boolean_get_array(op->ptr, "layers", values);
- for (a=0; a<20; a++)
+ for (a = 0; a < 20; a++)
if (values[a])
lay |= (1 << a);
}
@@ -1083,7 +1081,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- View3D *v3d= CTX_wm_view3d(C);
+ View3D *v3d = CTX_wm_view3d(C);
if (v3d && v3d->localvd) {
return WM_operator_confirm_message(C, op, "Move from localview");
}
@@ -1095,24 +1093,24 @@ static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int move_to_layer_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
unsigned int lay, local;
/* int islamp= 0; */ /* UNUSED */
- lay= move_to_layer_init(C, op);
+ lay = move_to_layer_init(C, op);
lay &= 0xFFFFFF;
- if (lay==0) return OPERATOR_CANCELLED;
+ if (lay == 0) return OPERATOR_CANCELLED;
if (v3d && v3d->localvd) {
/* now we can move out of localview. */
/* note: layers are set in bases, library objects work for this */
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
- lay= base->lay & ~v3d->lay;
- base->lay= lay;
- base->object->lay= lay;
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
+ lay = base->lay & ~v3d->lay;
+ base->lay = lay;
+ base->object->lay = lay;
base->object->flag &= ~SELECT;
base->flag &= ~SELECT;
/* if (base->object->type==OB_LAMP) islamp= 1; */
@@ -1122,11 +1120,11 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
else {
/* normal non localview operation */
/* note: layers are set in bases, library objects work for this */
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
/* upper byte is used for local view */
- local= base->lay & 0xFF000000;
- base->lay= lay + local;
- base->object->lay= lay;
+ local = base->lay & 0xFF000000;
+ base->lay = lay + local;
+ base->object->lay = lay;
/* if (base->object->type==OB_LAMP) islamp= 1; */
}
CTX_DATA_END;
@@ -1134,8 +1132,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
/* warning, active object may be hidden now */
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
DAG_scene_sort(bmain, scene);
@@ -1155,7 +1153,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
@@ -1166,18 +1164,18 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
#if 0
static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
{
- Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1);
+ Scene *sce = (Scene *) BLI_findlink(&bmain->scene, G.curscreen->scenenr - 1);
Base *base, *nbase;
- if (sce==0) return;
+ if (sce == 0) return;
if (sce->id.lib) return;
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
- nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(sce->base), nbase);
+ nbase = MEM_mallocN(sizeof(Base), "newbase");
+ *nbase = *base;
+ BLI_addhead(&(sce->base), nbase);
id_us_plus((ID *)base->object);
}
}
@@ -1186,10 +1184,10 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
static int make_links_scene_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
+ Main *bmain = CTX_data_main(C);
+ Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
- if (scene_to==NULL) {
+ if (scene_to == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
@@ -1204,12 +1202,11 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Base*, base, selected_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
if (!object_in_scene(base->object, scene_to)) {
- Base *nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(scene_to->base), nbase);
+ Base *nbase = MEM_mallocN(sizeof(Base), "newbase");
+ *nbase = *base;
+ BLI_addhead(&(scene_to->base), nbase);
id_us_plus((ID *)base->object);
}
}
@@ -1232,14 +1229,14 @@ enum {
/* Return 1 if make link data is allow, zero otherwise */
static int allow_make_links_data(int ev, Object *ob, Object *obt)
{
- switch(ev) {
+ switch (ev) {
case MAKE_LINKS_OBDATA:
if (ob->type == obt->type && ob->type != OB_EMPTY)
return 1;
break;
case MAKE_LINKS_MATERIALS:
if (OB_TYPE_SUPPORT_MATERIAL(ob->type) &&
- OB_TYPE_SUPPORT_MATERIAL(obt->type))
+ OB_TYPE_SUPPORT_MATERIAL(obt->type))
{
return 1;
}
@@ -1257,53 +1254,53 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
static int make_links_data_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
int event = RNA_enum_get(op->ptr, "type");
Object *ob;
ID *id;
int a;
- ob= ED_object_active_context(C);
+ ob = ED_object_active_context(C);
- CTX_DATA_BEGIN(C, Object*, obt, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, obt, selected_editable_objects) {
if (ob != obt) {
if (allow_make_links_data(event, ob, obt)) {
- switch(event) {
- case MAKE_LINKS_OBDATA: /* obdata */
- id= obt->data;
- id->us--;
-
- id= ob->data;
- id_us_plus(id);
- obt->data= id;
-
- /* if amount of material indices changed: */
- test_object_materials(obt->data);
-
- obt->recalc |= OB_RECALC_DATA;
- break;
- case MAKE_LINKS_MATERIALS:
- /* new approach, using functions from kernel */
- for (a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
- assign_material(obt, ma, a+1); /* also works with ma==NULL */
- }
- break;
- case MAKE_LINKS_ANIMDATA:
- BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
- BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
- break;
- case MAKE_LINKS_DUPLIGROUP:
- obt->dup_group= ob->dup_group;
- if (obt->dup_group) {
- id_lib_extern(&obt->dup_group->id);
- obt->transflag |= OB_DUPLIGROUP;
- }
- break;
- case MAKE_LINKS_MODIFIERS:
- object_link_modifiers(obt, ob);
- obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- break;
+ switch (event) {
+ case MAKE_LINKS_OBDATA: /* obdata */
+ id = obt->data;
+ id->us--;
+
+ id = ob->data;
+ id_us_plus(id);
+ obt->data = id;
+
+ /* if amount of material indices changed: */
+ test_object_materials(obt->data);
+
+ obt->recalc |= OB_RECALC_DATA;
+ break;
+ case MAKE_LINKS_MATERIALS:
+ /* new approach, using functions from kernel */
+ for (a = 0; a < ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a + 1);
+ assign_material(obt, ma, a + 1); /* also works with ma==NULL */
+ }
+ break;
+ case MAKE_LINKS_ANIMDATA:
+ BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
+ BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
+ break;
+ case MAKE_LINKS_DUPLIGROUP:
+ obt->dup_group = ob->dup_group;
+ if (obt->dup_group) {
+ id_lib_extern(&obt->dup_group->id);
+ obt->transflag |= OB_DUPLIGROUP;
+ }
+ break;
+ case MAKE_LINKS_MODIFIERS:
+ object_link_modifiers(obt, ob);
+ obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ break;
}
}
}
@@ -1313,7 +1310,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, CTX_data_scene(C));
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
return OPERATOR_FINISHED;
}
@@ -1333,22 +1330,22 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
/* better not run the poll check */
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
+ prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
RNA_def_enum_funcs(prop, RNA_scene_local_itemf);
ot->prop = prop;
}
void OBJECT_OT_make_links_data(wmOperatorType *ot)
{
- static EnumPropertyItem make_links_items[]= {
- {MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
- {MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
- {MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
- {MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
- {MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
+ static EnumPropertyItem make_links_items[] = {
+ {MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
+ {MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
+ {MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
+ {MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
+ {MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
@@ -1361,7 +1358,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
ot->poll = ED_operator_object_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", make_links_items, 0, "Type", "");
@@ -1375,22 +1372,22 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
Base *base;
Object *ob, *obn;
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
/* duplicate (must set newid) */
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
/* newid may still have some trash from Outliner tree building,
* so clear that first to avoid errors [#26002]
*/
ob->id.newid = NULL;
- if ( (base->flag & flag)==flag ) {
- if (ob->id.lib==NULL && ob->id.us>1) {
+ if ( (base->flag & flag) == flag) {
+ if (ob->id.lib == NULL && ob->id.us > 1) {
/* base gets copy of object */
- obn= copy_object(ob);
- base->object= obn;
+ obn = copy_object(ob);
+ base->object = obn;
ob->id.us--;
}
}
@@ -1400,7 +1397,7 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
if (v3d) ID_NEW(v3d->camera);
/* object pointers */
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
object_relink(base->object);
}
@@ -1413,9 +1410,9 @@ void ED_object_single_user(Scene *scene, Object *ob)
{
Base *base;
- for (base= FIRSTBASE; base; base= base->next) {
- if (base->object == ob) base->flag |= OB_DONE;
- else base->flag &= ~OB_DONE;
+ for (base = FIRSTBASE; base; base = base->next) {
+ if (base->object == ob) base->flag |= OB_DONE;
+ else base->flag &= ~OB_DONE;
}
single_object_users(scene, NULL, OB_DONE);
@@ -1426,18 +1423,18 @@ static void new_id_matar(Material **matar, int totcol)
ID *id;
int a;
- for (a=0; a<totcol; a++) {
- id= (ID *)matar[a];
+ for (a = 0; a < totcol; a++) {
+ id = (ID *)matar[a];
if (id && id->lib == NULL) {
if (id->newid) {
- matar[a]= (Material *)id->newid;
+ matar[a] = (Material *)id->newid;
id_us_plus(id->newid);
id->us--;
}
- else if (id->us>1) {
- matar[a]= copy_material(matar[a]);
+ else if (id->us > 1) {
+ matar[a] = copy_material(matar[a]);
id->us--;
- id->newid= (ID *)matar[a];
+ id->newid = (ID *)matar[a];
}
}
}
@@ -1454,73 +1451,73 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
ID *id;
int a;
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
- if (ob->id.lib==NULL && (base->flag & flag)==flag ) {
- id= ob->data;
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
+ if (ob->id.lib == NULL && (base->flag & flag) == flag) {
+ id = ob->data;
- if (id && id->us>1 && id->lib==NULL) {
- ob->recalc= OB_RECALC_DATA;
+ if (id && id->us > 1 && id->lib == NULL) {
+ ob->recalc = OB_RECALC_DATA;
BKE_copy_animdata_id_action(id);
- switch(ob->type) {
- case OB_LAMP:
- ob->data= la= copy_lamp(ob->data);
- for (a=0; a<MAX_MTEX; a++) {
- if (la->mtex[a]) {
- ID_NEW(la->mtex[a]->object);
+ switch (ob->type) {
+ case OB_LAMP:
+ ob->data = la = copy_lamp(ob->data);
+ for (a = 0; a < MAX_MTEX; a++) {
+ if (la->mtex[a]) {
+ ID_NEW(la->mtex[a]->object);
+ }
}
- }
- break;
- case OB_CAMERA:
- ob->data= copy_camera(ob->data);
- break;
- case OB_MESH:
- ob->data= copy_mesh(ob->data);
- //me= ob->data;
- //if (me && me->key)
- // ipo_idnew(me->key->ipo); /* drivers */
- break;
- case OB_MBALL:
- ob->data= copy_mball(ob->data);
- break;
- case OB_CURVE:
- case OB_SURF:
- case OB_FONT:
- ob->data= cu= copy_curve(ob->data);
- ID_NEW(cu->bevobj);
- ID_NEW(cu->taperobj);
- break;
- case OB_LATTICE:
- ob->data= copy_lattice(ob->data);
- break;
- case OB_ARMATURE:
- ob->recalc |= OB_RECALC_DATA;
- ob->data= copy_armature(ob->data);
- armature_rebuild_pose(ob, ob->data);
- break;
- case OB_SPEAKER:
- ob->data= copy_speaker(ob->data);
- break;
- default:
- if (G.debug & G_DEBUG)
- printf("ERROR %s: can't copy %s\n", __func__, id->name);
- return;
+ break;
+ case OB_CAMERA:
+ ob->data = copy_camera(ob->data);
+ break;
+ case OB_MESH:
+ ob->data = copy_mesh(ob->data);
+ //me= ob->data;
+ //if (me && me->key)
+ // ipo_idnew(me->key->ipo); /* drivers */
+ break;
+ case OB_MBALL:
+ ob->data = BKE_metaball_copy(ob->data);
+ break;
+ case OB_CURVE:
+ case OB_SURF:
+ case OB_FONT:
+ ob->data = cu = BKE_curve_copy(ob->data);
+ ID_NEW(cu->bevobj);
+ ID_NEW(cu->taperobj);
+ break;
+ case OB_LATTICE:
+ ob->data = copy_lattice(ob->data);
+ break;
+ case OB_ARMATURE:
+ ob->recalc |= OB_RECALC_DATA;
+ ob->data = copy_armature(ob->data);
+ armature_rebuild_pose(ob, ob->data);
+ break;
+ case OB_SPEAKER:
+ ob->data = copy_speaker(ob->data);
+ break;
+ default:
+ if (G.debug & G_DEBUG)
+ printf("ERROR %s: can't copy %s\n", __func__, id->name);
+ return;
}
id->us--;
- id->newid= ob->data;
+ id->newid = ob->data;
}
}
}
- me= bmain->mesh.first;
+ me = bmain->mesh.first;
while (me) {
ID_NEW(me->texcomesh);
- me= me->id.next;
+ me = me->id.next;
}
}
@@ -1529,10 +1526,10 @@ static void single_object_action_users(Scene *scene, int flag)
Object *ob;
Base *base;
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
- if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
- ob->recalc= OB_RECALC_DATA;
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
+ if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
+ ob->recalc = OB_RECALC_DATA;
BKE_copy_animdata_id_action(&ob->id);
}
}
@@ -1546,30 +1543,30 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
Tex *tex;
int a, b;
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
- if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
+ if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
- for (a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
+ for (a = 1; a <= ob->totcol; a++) {
+ ma = give_current_material(ob, a);
if (ma) {
/* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
- if (ma->id.us>1) {
- man= copy_material(ma);
+ if (ma->id.us > 1) {
+ man = copy_material(ma);
BKE_copy_animdata_id_action(&man->id);
- man->id.us= 0;
+ man->id.us = 0;
assign_material(ob, man, a);
if (do_textures) {
- for (b=0; b<MAX_MTEX; b++) {
- if (ma->mtex[b] && (tex= ma->mtex[b]->tex)) {
- if (tex->id.us>1) {
+ for (b = 0; b < MAX_MTEX; b++) {
+ if (ma->mtex[b] && (tex = ma->mtex[b]->tex)) {
+ if (tex->id.us > 1) {
tex->id.us--;
- tex= copy_texture(tex);
+ tex = copy_texture(tex);
BKE_copy_animdata_id_action(&tex->id);
- man->mtex[b]->tex= tex;
+ man->mtex[b]->tex = tex;
}
}
}
@@ -1585,20 +1582,20 @@ static void do_single_tex_user(Tex **from)
{
Tex *tex, *texn;
- tex= *from;
- if (tex==NULL) return;
+ tex = *from;
+ if (tex == NULL) return;
if (tex->id.newid) {
- *from= (Tex *)tex->id.newid;
+ *from = (Tex *)tex->id.newid;
id_us_plus(tex->id.newid);
tex->id.us--;
}
- else if (tex->id.us>1) {
- texn= copy_texture(tex);
+ else if (tex->id.us > 1) {
+ texn = copy_texture(tex);
BKE_copy_animdata_id_action(&texn->id);
- tex->id.newid= (ID *)texn;
+ tex->id.newid = (ID *)texn;
tex->id.us--;
- *from= texn;
+ *from = texn;
}
}
@@ -1610,31 +1607,31 @@ static void single_tex_users_expand(Main *bmain)
World *wo;
int b;
- for (ma= bmain->mat.first; ma; ma=ma->id.next) {
+ for (ma = bmain->mat.first; ma; ma = ma->id.next) {
if (ma->id.flag & LIB_NEW) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (ma->mtex[b] && ma->mtex[b]->tex) {
- do_single_tex_user( &(ma->mtex[b]->tex) );
+ do_single_tex_user(&(ma->mtex[b]->tex));
}
}
}
}
- for (la= bmain->lamp.first; la; la=la->id.next) {
+ for (la = bmain->lamp.first; la; la = la->id.next) {
if (la->id.flag & LIB_NEW) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (la->mtex[b] && la->mtex[b]->tex) {
- do_single_tex_user( &(la->mtex[b]->tex) );
+ do_single_tex_user(&(la->mtex[b]->tex));
}
}
}
}
- for (wo= bmain->world.first; wo; wo=wo->id.next) {
+ for (wo = bmain->world.first; wo; wo = wo->id.next) {
if (wo->id.flag & LIB_NEW) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (wo->mtex[b] && wo->mtex[b]->tex) {
- do_single_tex_user( &(wo->mtex[b]->tex) );
+ do_single_tex_user(&(wo->mtex[b]->tex));
}
}
}
@@ -1651,26 +1648,26 @@ static void single_mat_users_expand(Main *bmain)
Material *ma;
int a;
- for (ob=bmain->object.first; ob; ob=ob->id.next)
+ for (ob = bmain->object.first; ob; ob = ob->id.next)
if (ob->id.flag & LIB_NEW)
new_id_matar(ob->mat, ob->totcol);
- for (me=bmain->mesh.first; me; me=me->id.next)
+ for (me = bmain->mesh.first; me; me = me->id.next)
if (me->id.flag & LIB_NEW)
new_id_matar(me->mat, me->totcol);
- for (cu=bmain->curve.first; cu; cu=cu->id.next)
+ for (cu = bmain->curve.first; cu; cu = cu->id.next)
if (cu->id.flag & LIB_NEW)
new_id_matar(cu->mat, cu->totcol);
- for (mb=bmain->mball.first; mb; mb=mb->id.next)
+ for (mb = bmain->mball.first; mb; mb = mb->id.next)
if (mb->id.flag & LIB_NEW)
new_id_matar(mb->mat, mb->totcol);
/* material imats */
- for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ for (ma = bmain->mat.first; ma; ma = ma->id.next)
if (ma->id.flag & LIB_NEW)
- for (a=0; a<MAX_MTEX; a++)
+ for (a = 0; a < MAX_MTEX; a++)
if (ma->mtex[a])
ID_NEW(ma->mtex[a]->object);
}
@@ -1700,11 +1697,11 @@ static void make_local_makelocalmaterial(Material *ma)
id_make_local(&ma->id, 0);
- for (b=0; b<MAX_MTEX; b++)
+ for (b = 0; b < MAX_MTEX; b++)
if (ma->mtex[b] && ma->mtex[b]->tex)
id_make_local(&ma->mtex[b]->tex->id, 0);
- adt= BKE_animdata_from_id(&ma->id);
+ adt = BKE_animdata_from_id(&ma->id);
if (adt) BKE_animdata_make_local(adt);
/* nodetree? XXX */
@@ -1712,83 +1709,83 @@ static void make_local_makelocalmaterial(Material *ma)
static int make_local_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
AnimData *adt;
ParticleSystem *psys;
Material *ma, ***matarar;
Lamp *la;
ID *id;
- int a, b, mode= RNA_enum_get(op->ptr, "type");
+ int a, b, mode = RNA_enum_get(op->ptr, "type");
- if (mode==3) {
- BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */
+ if (mode == 3) {
+ BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
clear_id_newpoins();
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
if (ob->id.lib)
id_make_local(&ob->id, 0);
}
CTX_DATA_END;
/* maybe object pointers */
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- if (ob->id.lib==NULL) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
+ if (ob->id.lib == NULL) {
ID_NEW(ob->parent);
}
}
CTX_DATA_END;
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- id= ob->data;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
+ id = ob->data;
- if (id && mode>1) {
+ if (id && mode > 1) {
id_make_local(id, 0);
- adt= BKE_animdata_from_id(id);
+ adt = BKE_animdata_from_id(id);
if (adt) BKE_animdata_make_local(adt);
/* tag indirect data direct */
- matarar= (Material ***)give_matarar(ob);
+ matarar = (Material ***)give_matarar(ob);
if (matarar) {
- for (a=0; a<ob->totcol; a++) {
- ma= (*matarar)[a];
+ for (a = 0; a < ob->totcol; a++) {
+ ma = (*matarar)[a];
if (ma)
id_lib_extern(&ma->id);
}
}
}
- for (psys=ob->particlesystem.first; psys; psys=psys->next)
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
id_make_local(&psys->part->id, 0);
- adt= BKE_animdata_from_id(&ob->id);
+ adt = BKE_animdata_from_id(&ob->id);
if (adt) BKE_animdata_make_local(adt);
}
CTX_DATA_END;
- if (mode>1) {
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- if (ob->type==OB_LAMP) {
- la= ob->data;
+ if (mode > 1) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
+ if (ob->type == OB_LAMP) {
+ la = ob->data;
- for (b=0; b<MAX_MTEX; b++)
+ for (b = 0; b < MAX_MTEX; b++)
if (la->mtex[b] && la->mtex[b]->tex)
id_make_local(&la->mtex[b]->tex->id, 0);
}
else {
- for (a=0; a<ob->totcol; a++) {
- ma= ob->mat[a];
+ for (a = 0; a < ob->totcol; a++) {
+ ma = ob->mat[a];
if (ma)
make_local_makelocalmaterial(ma);
}
- matarar= (Material ***)give_matarar(ob);
+ matarar = (Material ***)give_matarar(ob);
if (matarar) {
- for (a=0; a<ob->totcol; a++) {
- ma= (*matarar)[a];
+ for (a = 0; a < ob->totcol; a++) {
+ ma = (*matarar)[a];
if (ma)
make_local_makelocalmaterial(ma);
}
@@ -1805,7 +1802,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
void OBJECT_OT_make_local(wmOperatorType *ot)
{
- static EnumPropertyItem type_items[]= {
+ static EnumPropertyItem type_items[] = {
{1, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
{2, "SELECTED_OBJECTS_DATA", 0, "Selected Objects and Data", ""},
{3, "ALL", 0, "All", ""},
@@ -1822,7 +1819,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
@@ -1830,10 +1827,10 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
static int make_single_user_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C); /* ok if this is NULL */
- int flag= RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C); /* ok if this is NULL */
+ int flag = RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */
if (RNA_boolean_get(op->ptr, "object"))
single_object_users(scene, v3d, flag);
@@ -1859,7 +1856,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
void OBJECT_OT_make_single_user(wmOperatorType *ot)
{
- static EnumPropertyItem type_items[]= {
+ static EnumPropertyItem type_items[] = {
{SELECT, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
{0, "ALL", 0, "All", ""},
{0, NULL, 0, NULL, NULL}};
@@ -1875,7 +1872,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, SELECT, "Type", "");
@@ -1889,20 +1886,20 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- Main *bmain= CTX_data_main(C);
- Base *base= ED_view3d_give_base_under_cursor(C, event->mval);
+ Main *bmain = CTX_data_main(C);
+ Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
Material *ma;
- char name[MAX_ID_NAME-2];
+ char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
- ma= (Material *)find_id("MA", name);
- if (base==NULL || ma==NULL)
+ ma = (Material *)find_id("MA", name);
+ if (base == NULL || ma == NULL)
return OPERATOR_CANCELLED;
assign_material(base->object, ma, 1);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
return OPERATOR_FINISHED;
}
@@ -1925,5 +1922,5 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME-2, "Name", "Material name to assign");
+ RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign");
}
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 388766f5fa3..7a4db175ee4 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -79,8 +79,8 @@
/************************ Exported **************************/
/* simple API for object selection, rather than just using the flag
- * this takes into account the 'restrict selection in 3d view' flag.
- * deselect works always, the restriction just prevents selection */
+* this takes into account the 'restrict selection in 3d view' flag.
+* deselect works always, the restriction just prevents selection */
/* Note: send a NC_SCENE|ND_OB_SELECT notifier yourself! (or
* or a NC_SCENE|ND_OB_VISIBLE in case of visibility toggling */
@@ -88,34 +88,34 @@
void ED_base_object_select(Base *base, short mode)
{
if (base) {
- if (mode==BA_SELECT) {
+ if (mode == BA_SELECT) {
if (!(base->object->restrictflag & OB_RESTRICT_SELECT))
base->flag |= SELECT;
}
- else if (mode==BA_DESELECT) {
+ else if (mode == BA_DESELECT) {
base->flag &= ~SELECT;
}
- base->object->flag= base->flag;
+ base->object->flag = base->flag;
}
}
/* also to set active NULL */
void ED_base_object_activate(bContext *C, Base *base)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* sets scene->basact */
- BASACT= base;
+ BASACT = base;
if (base) {
/* XXX old signals, remember to handle notifiers now! */
// select_actionchannel_by_name(base->object->action, "Object", 1);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
else
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
}
/********************** Selection Operators **********************/
@@ -124,7 +124,7 @@ static int objects_selectable_poll(bContext *C)
{
/* we don't check for linked scenes here, selection is
* still allowed then for inspection of scene */
- Object *obact= CTX_data_active_object(C);
+ Object *obact = CTX_data_active_object(C);
if (CTX_data_edit_object(C))
return 0;
@@ -141,23 +141,23 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
short obtype, extend;
obtype = RNA_enum_get(op->ptr, "type");
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (base->object->type==obtype) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
+ if (base->object->type == obtype) {
ED_base_object_select(base, BA_SELECT);
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -175,7 +175,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -198,11 +198,11 @@ static EnumPropertyItem prop_select_linked_types[] = {
static int object_select_linked_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
void *obdata = NULL;
Material *mat = NULL, *mat1;
- Tex *tex= NULL;
+ Tex *tex = NULL;
int a, b;
int nr = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;
@@ -215,77 +215,77 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
* PSys: 6
*/
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- ob= OBACT;
- if (ob==NULL) {
+ ob = OBACT;
+ if (ob == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Active Object");
return OPERATOR_CANCELLED;
}
- if (nr==1) {
- // XXX old animation system
+ if (nr == 1) {
+ // XXX old animation system
//ipo= ob->ipo;
//if (ipo==0) return OPERATOR_CANCELLED;
return OPERATOR_CANCELLED;
}
- else if (nr==2) {
- if (ob->data==NULL) return OPERATOR_CANCELLED;
- obdata= ob->data;
+ else if (nr == 2) {
+ if (ob->data == NULL) return OPERATOR_CANCELLED;
+ obdata = ob->data;
}
- else if (nr==3 || nr==4) {
- mat= give_current_material(ob, ob->actcol);
- if (mat==NULL) return OPERATOR_CANCELLED;
- if (nr==4) {
- if (mat->mtex[ (int)mat->texact ]) tex= mat->mtex[ (int)mat->texact ]->tex;
- if (tex==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 3 || nr == 4) {
+ mat = give_current_material(ob, ob->actcol);
+ if (mat == NULL) return OPERATOR_CANCELLED;
+ if (nr == 4) {
+ if (mat->mtex[(int)mat->texact]) tex = mat->mtex[(int)mat->texact]->tex;
+ if (tex == NULL) return OPERATOR_CANCELLED;
}
}
- else if (nr==5) {
- if (ob->dup_group==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 5) {
+ if (ob->dup_group == NULL) return OPERATOR_CANCELLED;
}
- else if (nr==6) {
- if (ob->particlesystem.first==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 6) {
+ if (ob->particlesystem.first == NULL) return OPERATOR_CANCELLED;
}
- else if (nr==7) {
+ else if (nr == 7) {
/* do nothing */
}
- else if (nr==8) {
- if (ob->data==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 8) {
+ if (ob->data == NULL) return OPERATOR_CANCELLED;
}
else
return OPERATOR_CANCELLED;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (nr==1) {
- // XXX old animation system
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
+ if (nr == 1) {
+ // XXX old animation system
//if (base->object->ipo==ipo) base->flag |= SELECT;
//changed = 1;
}
- else if (nr==2) {
- if (base->object->data==obdata) base->flag |= SELECT;
+ else if (nr == 2) {
+ if (base->object->data == obdata) base->flag |= SELECT;
changed = 1;
}
- else if (nr==3 || nr==4) {
- ob= base->object;
+ else if (nr == 3 || nr == 4) {
+ ob = base->object;
- for (a=1; a<=ob->totcol; a++) {
- mat1= give_current_material(ob, a);
- if (nr==3) {
- if (mat1==mat) base->flag |= SELECT;
+ for (a = 1; a <= ob->totcol; a++) {
+ mat1 = give_current_material(ob, a);
+ if (nr == 3) {
+ if (mat1 == mat) base->flag |= SELECT;
changed = 1;
}
- else if (mat1 && nr==4) {
- for (b=0; b<MAX_MTEX; b++) {
+ else if (mat1 && nr == 4) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (mat1->mtex[b]) {
- if (tex==mat1->mtex[b]->tex) {
+ if (tex == mat1->mtex[b]->tex) {
base->flag |= SELECT;
changed = 1;
break;
@@ -295,19 +295,19 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
}
}
}
- else if (nr==5) {
- if (base->object->dup_group==ob->dup_group) {
+ else if (nr == 5) {
+ if (base->object->dup_group == ob->dup_group) {
base->flag |= SELECT;
changed = 1;
}
}
- else if (nr==6) {
+ else if (nr == 6) {
/* loop through other, then actives particles*/
ParticleSystem *psys;
ParticleSystem *psys_act;
- for (psys=base->object->particlesystem.first; psys; psys=psys->next) {
- for (psys_act=ob->particlesystem.first; psys_act; psys_act=psys_act->next) {
+ for (psys = base->object->particlesystem.first; psys; psys = psys->next) {
+ for (psys_act = ob->particlesystem.first; psys_act; psys_act = psys_act->next) {
if (psys->part == psys_act->part) {
base->flag |= SELECT;
changed = 1;
@@ -320,24 +320,24 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
}
}
}
- else if (nr==7) {
+ else if (nr == 7) {
if (ob->id.lib == base->object->id.lib) {
base->flag |= SELECT;
- changed= 1;
+ changed = 1;
}
}
- else if (nr==8) {
+ else if (nr == 8) {
if (base->object->data && ((ID *)ob->data)->lib == ((ID *)base->object->data)->lib) {
base->flag |= SELECT;
- changed= 1;
+ changed = 1;
}
}
- base->object->flag= base->flag;
+ base->object->flag = base->flag;
}
CTX_DATA_END;
if (changed) {
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -357,7 +357,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -386,7 +386,7 @@ static short select_grouped_children(bContext *C, Object *ob, int recursive)
{
short changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (ob == base->object->parent) {
if (!(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
@@ -401,17 +401,17 @@ static short select_grouped_children(bContext *C, Object *ob, int recursive)
return changed;
}
-static short select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */
+static short select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */
{
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
short changed = 0;
- Base *baspar, *basact= CTX_data_active_base(C);
+ Base *baspar, *basact = CTX_data_active_base(C);
- if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */
+ if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */
- baspar= object_in_scene(basact->object->parent, scene);
+ baspar = object_in_scene(basact->object->parent, scene);
/* can be NULL if parent in other scene */
if (baspar && BASE_SELECTABLE(v3d, baspar)) {
@@ -424,17 +424,17 @@ static short select_grouped_parent(bContext *C) /* Makes parent active and de-se
}
-#define GROUP_MENU_MAX 24
-static short select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */
+#define GROUP_MENU_MAX 24
+static short select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */
{
short changed = 0;
Group *group, *ob_groups[GROUP_MENU_MAX];
- int group_count=0, i;
+ int group_count = 0, i;
uiPopupMenu *pup;
uiLayout *layout;
- for (group=CTX_data_main(C)->group.first; group && group_count < GROUP_MENU_MAX; group=group->id.next) {
- if (object_in_group (ob, group)) {
+ for (group = CTX_data_main(C)->group.first; group && group_count < GROUP_MENU_MAX; group = group->id.next) {
+ if (object_in_group(ob, group)) {
ob_groups[group_count] = group;
group_count++;
}
@@ -444,7 +444,7 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
return 0;
else if (group_count == 1) {
group = ob_groups[0];
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!(base->flag & SELECT) && object_in_group(base->object, group)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -455,12 +455,12 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
}
/* build the menu. */
- pup= uiPupMenuBegin(C, "Select Group", ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, "Select Group", ICON_NONE);
+ layout = uiPupMenuLayout(pup);
- for (i=0; i<group_count; i++) {
+ for (i = 0; i < group_count; i++) {
group = ob_groups[i];
- uiItemStringO(layout, group->id.name+2, 0, "OBJECT_OT_select_same_group", "group", group->id.name);
+ uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name);
}
uiPupMenuEnd(C, pup);
@@ -469,19 +469,19 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
static short select_grouped_object_hooks(bContext *C, Object *ob)
{
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
short changed = 0;
Base *base;
ModifierData *md;
HookModifierData *hmd;
- for (md = ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- hmd= (HookModifierData*) md;
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Hook) {
+ hmd = (HookModifierData *) md;
if (hmd->object && !(hmd->object->flag & SELECT)) {
- base= object_in_scene(hmd->object, scene);
+ base = object_in_scene(hmd->object, scene);
if (base && (BASE_SELECTABLE(v3d, base))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -498,8 +498,8 @@ static short select_grouped_siblings(bContext *C, Object *ob)
{
short changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
- if ((base->object->parent==ob->parent) && !(base->flag & SELECT)) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
+ if ((base->object->parent == ob->parent) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
}
@@ -512,7 +512,7 @@ static short select_grouped_type(bContext *C, Object *ob)
{
short changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if ((base->object->type == ob->type) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -526,7 +526,7 @@ static short select_grouped_layer(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if ((base->lay & ob->lay) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -540,7 +540,7 @@ static short select_grouped_index_object(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if ((base->object->index == ob->index) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -554,7 +554,7 @@ static short select_grouped_color(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (!(base->flag & SELECT) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -569,8 +569,8 @@ static short objects_share_gameprop(Object *a, Object *b)
bProperty *prop;
/*make a copy of all its properties*/
- for ( prop= a->prop.first; prop; prop = prop->next ) {
- if ( get_ob_property(b, prop->name) )
+ for (prop = a->prop.first; prop; prop = prop->next) {
+ if (get_ob_property(b, prop->name) )
return 1;
}
return 0;
@@ -580,7 +580,7 @@ static short select_grouped_gameprops(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (!(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -602,8 +602,7 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
/* select each object that Keying Set refers to */
// TODO: perhaps to be more in line with the rest of these, we should only take objects
// if the passed in object is included in this too
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
/* only check for this object if it isn't selected already, to limit time wasted */
if ((base->flag & SELECT) == 0) {
KS_Path *ksp;
@@ -628,42 +627,42 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
static int object_select_grouped_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
int nr = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
changed = 1;
}
CTX_DATA_END;
}
- ob= OBACT;
- if (ob==NULL) {
+ ob = OBACT;
+ if (ob == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Active Object");
return OPERATOR_CANCELLED;
}
- if (nr==1) changed |= select_grouped_children(C, ob, 1);
- else if (nr==2) changed |= select_grouped_children(C, ob, 0);
- else if (nr==3) changed |= select_grouped_parent(C);
- else if (nr==4) changed |= select_grouped_siblings(C, ob);
- else if (nr==5) changed |= select_grouped_type(C, ob);
- else if (nr==6) changed |= select_grouped_layer(C, ob);
- else if (nr==7) changed |= select_grouped_group(C, ob);
- else if (nr==8) changed |= select_grouped_object_hooks(C, ob);
- else if (nr==9) changed |= select_grouped_index_object(C, ob);
- else if (nr==10) changed |= select_grouped_color(C, ob);
- else if (nr==11) changed |= select_grouped_gameprops(C, ob);
- else if (nr==12) changed |= select_grouped_keyingset(C, ob);
+ if (nr == 1) changed |= select_grouped_children(C, ob, 1);
+ else if (nr == 2) changed |= select_grouped_children(C, ob, 0);
+ else if (nr == 3) changed |= select_grouped_parent(C);
+ else if (nr == 4) changed |= select_grouped_siblings(C, ob);
+ else if (nr == 5) changed |= select_grouped_type(C, ob);
+ else if (nr == 6) changed |= select_grouped_layer(C, ob);
+ else if (nr == 7) changed |= select_grouped_group(C, ob);
+ else if (nr == 8) changed |= select_grouped_object_hooks(C, ob);
+ else if (nr == 9) changed |= select_grouped_index_object(C, ob);
+ else if (nr == 10) changed |= select_grouped_color(C, ob);
+ else if (nr == 11) changed |= select_grouped_gameprops(C, ob);
+ else if (nr == 12) changed |= select_grouped_keyingset(C, ob);
if (changed) {
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -683,7 +682,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -697,24 +696,24 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
unsigned int layernum;
short extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
layernum = RNA_int_get(op->ptr, "layers");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (base->lay == (1<< (layernum -1)))
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
+ if (base->lay == (1 << (layernum - 1)))
ED_base_object_select(base, BA_SELECT);
}
CTX_DATA_END;
/* undo? */
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -732,7 +731,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -750,7 +749,7 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (base->flag & SELECT) {
action = SEL_DESELECT;
break;
@@ -759,27 +758,27 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
switch (action) {
- case SEL_SELECT:
- ED_base_object_select(base, BA_SELECT);
- break;
- case SEL_DESELECT:
- ED_base_object_select(base, BA_DESELECT);
- break;
- case SEL_INVERT:
- if (base->flag & SELECT) {
- ED_base_object_select(base, BA_DESELECT);
- }
- else {
+ case SEL_SELECT:
ED_base_object_select(base, BA_SELECT);
- }
- break;
+ break;
+ case SEL_DESELECT:
+ ED_base_object_select(base, BA_DESELECT);
+ break;
+ case SEL_INVERT:
+ if (base->flag & SELECT) {
+ ED_base_object_select(base, BA_DESELECT);
+ }
+ else {
+ ED_base_object_select(base, BA_SELECT);
+ }
+ break;
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -797,7 +796,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -814,7 +813,7 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "group", group_name);
- for (group=CTX_data_main(C)->group.first; group; group=group->id.next) {
+ for (group = CTX_data_main(C)->group.first; group; group = group->id.next) {
if (!strcmp(group->id.name, group_name))
break;
}
@@ -822,13 +821,13 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op)
if (!group)
return OPERATOR_PASS_THROUGH;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!(base->flag & SELECT) && object_in_group(base->object, group))
ED_base_object_select(base, BA_SELECT);
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -846,7 +845,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_string(ot->srna, "group", "", MAX_ID_NAME, "Group", "Name of the group to select");
}
@@ -854,20 +853,20 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
/**************************** Select Mirror ****************************/
static int object_select_mirror_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
short extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
- CTX_DATA_BEGIN(C, Base*, primbase, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, primbase, selected_bases) {
char tmpname[MAXBONENAME];
- flip_side_name(tmpname, primbase->object->id.name+2, TRUE);
+ flip_side_name(tmpname, primbase->object->id.name + 2, TRUE);
- if (strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */
- Object *ob= (Object *)find_id("OB", tmpname);
+ if (strcmp(tmpname, primbase->object->id.name + 2) != 0) { /* names differ */
+ Object *ob = (Object *)find_id("OB", tmpname);
if (ob) {
- Base *secbase= object_in_scene(ob, scene);
+ Base *secbase = object_in_scene(ob, scene);
if (secbase) {
ED_base_object_select(secbase, BA_SELECT);
@@ -881,7 +880,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* undo? */
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -899,7 +898,7 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
}
@@ -912,24 +911,24 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
float percent;
short extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- percent = RNA_float_get(op->ptr, "percent")/100.0f;
+ percent = RNA_float_get(op->ptr, "percent") / 100.0f;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (BLI_frand() < percent) {
ED_base_object_select(base, BA_SELECT);
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -947,7 +946,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", 0.f, 100.0f);
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 79b1ca13c9e..5d31bfff99a 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -78,11 +78,11 @@ static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int f
{
KeyBlock *kb;
if ((kb = object_insert_shape_key(scene, ob, NULL, from_mix))) {
- Key *key= ob_get_key(ob);
+ Key *key = ob_get_key(ob);
/* for absolute shape keys, new keys may not be added last */
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
}
}
@@ -90,36 +90,36 @@ static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int f
static int ED_object_shape_key_remove(bContext *C, Object *ob)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
KeyBlock *kb, *rkb;
Key *key;
//IpoCurve *icu;
- key= ob_get_key(ob);
- if (key==NULL)
+ key = ob_get_key(ob);
+ if (key == NULL)
return 0;
- kb= BLI_findlink(&key->block, ob->shapenr-1);
+ kb = BLI_findlink(&key->block, ob->shapenr - 1);
if (kb) {
- for (rkb= key->block.first; rkb; rkb= rkb->next)
- if (rkb->relative == ob->shapenr-1)
- rkb->relative= 0;
+ for (rkb = key->block.first; rkb; rkb = rkb->next)
+ if (rkb->relative == ob->shapenr - 1)
+ rkb->relative = 0;
BLI_remlink(&key->block, kb);
key->totkey--;
- if (key->refkey== kb) {
- key->refkey= key->block.first;
+ if (key->refkey == kb) {
+ key->refkey = key->block.first;
if (key->refkey) {
/* apply new basis key on original data */
- switch(ob->type) {
+ 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));
+ key_to_curve(key->refkey, ob->data, BKE_curve_nurbs_get(ob->data));
break;
case OB_LATTICE:
key_to_latt(key->refkey, ob->data);
@@ -136,16 +136,16 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
}
}
- if (key->totkey==0) {
- if (GS(key->from->name)==ID_ME) ((Mesh *)key->from)->key= NULL;
- else if (GS(key->from->name)==ID_CU) ((Curve *)key->from)->key= NULL;
- else if (GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= NULL;
+ if (key->totkey == 0) {
+ if (GS(key->from->name) == ID_ME) ((Mesh *)key->from)->key = NULL;
+ else if (GS(key->from->name) == ID_CU) ((Curve *)key->from)->key = NULL;
+ else if (GS(key->from->name) == ID_LT) ((Lattice *)key->from)->key = NULL;
free_libblock_us(&(bmain->key), key);
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return 1;
}
@@ -155,53 +155,53 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
KeyBlock *kb;
Key *key;
- key= ob_get_key(ob);
- if (key==NULL)
+ key = ob_get_key(ob);
+ if (key == NULL)
return 0;
- kb= BLI_findlink(&key->block, ob->shapenr-1);
+ kb = BLI_findlink(&key->block, ob->shapenr - 1);
if (kb) {
int i1, i2;
float *fp1, *fp2;
float tvec[3];
- char *tag_elem= MEM_callocN(sizeof(char) * kb->totelem, "shape_key_mirror");
+ char *tag_elem = MEM_callocN(sizeof(char) * kb->totelem, "shape_key_mirror");
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
MVert *mv;
mesh_octree_table(ob, NULL, NULL, 's');
- for (i1=0, mv=me->mvert; i1<me->totvert; i1++, mv++) {
- i2= mesh_get_x_mirror_vert(ob, i1);
- if (i2==i1) {
- fp1= ((float *)kb->data) + i1*3;
+ for (i1 = 0, mv = me->mvert; i1 < me->totvert; i1++, mv++) {
+ i2 = mesh_get_x_mirror_vert(ob, i1);
+ if (i2 == i1) {
+ fp1 = ((float *)kb->data) + i1 * 3;
fp1[0] = -fp1[0];
- tag_elem[i1]= 1;
+ tag_elem[i1] = 1;
}
else if (i2 != -1) {
- if (tag_elem[i1]==0 && tag_elem[i2]==0) {
- fp1= ((float *)kb->data) + i1*3;
- fp2= ((float *)kb->data) + i2*3;
+ if (tag_elem[i1] == 0 && tag_elem[i2] == 0) {
+ fp1 = ((float *)kb->data) + i1 * 3;
+ fp2 = ((float *)kb->data) + i2 * 3;
- copy_v3_v3(tvec, fp1);
- copy_v3_v3(fp1, fp2);
- copy_v3_v3(fp2, tvec);
+ copy_v3_v3(tvec, fp1);
+ copy_v3_v3(fp1, fp2);
+ copy_v3_v3(fp2, tvec);
/* flip x axis */
fp1[0] = -fp1[0];
fp2[0] = -fp2[0];
}
- tag_elem[i1]= tag_elem[i2]= 1;
+ tag_elem[i1] = tag_elem[i2] = 1;
}
}
mesh_octree_table(ob, NULL, NULL, 'e');
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= ob->data;
+ Lattice *lt = ob->data;
int i1, i2;
float *fp1, *fp2;
int u, v, w;
@@ -213,28 +213,28 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
/* if (lt->editlatt) lt= lt->editlatt->latt; */
- for (w=0; w<lt->pntsw; w++) {
- for (v=0; v<lt->pntsv; v++) {
- for (u=0; u<pntsu_half; u++) {
- int u_inv= (lt->pntsu - 1) - u;
+ for (w = 0; w < lt->pntsw; w++) {
+ for (v = 0; v < lt->pntsv; v++) {
+ for (u = 0; u < pntsu_half; u++) {
+ int u_inv = (lt->pntsu - 1) - u;
float tvec[3];
if (u == u_inv) {
- i1= LT_INDEX(lt, u, v, w);
- fp1= ((float *)kb->data) + i1*3;
- fp1[0]= -fp1[0];
+ i1 = LT_INDEX(lt, u, v, w);
+ fp1 = ((float *)kb->data) + i1 * 3;
+ fp1[0] = -fp1[0];
}
else {
- i1= LT_INDEX(lt, u, v, w);
- i2= LT_INDEX(lt, u_inv, v, w);
+ i1 = LT_INDEX(lt, u, v, w);
+ i2 = LT_INDEX(lt, u_inv, v, w);
- fp1= ((float *)kb->data) + i1*3;
- fp2= ((float *)kb->data) + i2*3;
+ fp1 = ((float *)kb->data) + i1 * 3;
+ fp2 = ((float *)kb->data) + i2 * 3;
copy_v3_v3(tvec, fp1);
copy_v3_v3(fp1, fp2);
copy_v3_v3(fp2, tvec);
- fp1[0]= -fp1[0];
- fp2[0]= -fp2[0];
+ fp1[0] = -fp1[0];
+ fp2[0] = -fp2[0];
}
}
}
@@ -245,7 +245,7 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return 1;
}
@@ -254,22 +254,22 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
static int shape_key_mode_poll(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT);
}
static int shape_key_poll(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && data && !data->lib);
}
static int shape_key_add_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
int from_mix = RNA_boolean_get(op->ptr, "from_mix");
ED_object_shape_key_add(C, scene, ob, from_mix);
@@ -289,7 +289,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
ot->exec = shape_key_add_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys");
@@ -297,7 +297,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (!ED_object_shape_key_remove(C, ob))
return OPERATOR_CANCELLED;
@@ -317,23 +317,23 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
ot->exec = shape_key_remove_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
- Key *key= ob_get_key(ob);
- KeyBlock *kb= ob_get_keyblock(ob);
+ Object *ob = ED_object_context(C);
+ Key *key = ob_get_key(ob);
+ KeyBlock *kb = ob_get_keyblock(ob);
if (!key || !kb)
return OPERATOR_CANCELLED;
- for (kb=key->block.first; kb; kb=kb->next)
- kb->curval= 0.0f;
+ for (kb = key->block.first; kb; kb = kb->next)
+ kb->curval = 0.0f;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -350,7 +350,7 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
ot->exec = shape_key_clear_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* starting point and step size could be optional */
@@ -364,11 +364,11 @@ static int shape_key_retime_exec(bContext *C, wmOperator *UNUSED(op))
if (!key || !kb)
return OPERATOR_CANCELLED;
- for (kb=key->block.first; kb; kb=kb->next)
+ for (kb = key->block.first; kb; kb = kb->next)
kb->pos = (cfra += 0.1f);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -385,12 +385,12 @@ void OBJECT_OT_shape_key_retime(wmOperatorType *ot)
ot->exec = shape_key_retime_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (!object_shape_key_mirror(C, ob))
return OPERATOR_CANCELLED;
@@ -409,28 +409,28 @@ void OBJECT_OT_shape_key_mirror(wmOperatorType *ot)
ot->exec = shape_key_mirror_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int shape_key_move_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
- int type= RNA_enum_get(op->ptr, "type");
- Key *key= ob_get_key(ob);
+ int type = RNA_enum_get(op->ptr, "type");
+ Key *key = ob_get_key(ob);
if (key) {
KeyBlock *kb, *kb_other;
- int shapenr_act= ob->shapenr-1;
- int shapenr_swap= shapenr_act + type;
- kb= BLI_findlink(&key->block, shapenr_act);
+ int shapenr_act = ob->shapenr - 1;
+ int shapenr_swap = shapenr_act + type;
+ kb = BLI_findlink(&key->block, shapenr_act);
- if ((type==-1 && kb->prev==NULL) || (type==1 && kb->next==NULL)) {
+ if ((type == -1 && kb->prev == NULL) || (type == 1 && kb->next == NULL)) {
return OPERATOR_CANCELLED;
}
- for (kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
+ for (kb_other = key->block.first; kb_other; kb_other = kb_other->next) {
if (kb_other->relative == shapenr_act) {
kb_other->relative += type;
}
@@ -439,16 +439,16 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
}
}
- if (type==-1) {
+ if (type == -1) {
/* move back */
- kb_other= kb->prev;
+ kb_other = kb->prev;
BLI_remlink(&key->block, kb);
BLI_insertlinkbefore(&key->block, kb_other, kb);
ob->shapenr--;
}
else {
/* move next */
- kb_other= kb->next;
+ kb_other = kb->next;
BLI_remlink(&key->block, kb);
BLI_insertlinkafter(&key->block, kb_other, kb);
ob->shapenr++;
@@ -458,7 +458,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -480,7 +480,7 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot)
ot->exec = shape_key_move_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 55954790687..e416bd5b762 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -78,57 +78,57 @@
static void object_clear_loc(Object *ob)
{
/* clear location if not locked */
- if ((ob->protectflag & OB_LOCK_LOCX)==0)
- ob->loc[0]= ob->dloc[0]= 0.0f;
- if ((ob->protectflag & OB_LOCK_LOCY)==0)
- ob->loc[1]= ob->dloc[1]= 0.0f;
- if ((ob->protectflag & OB_LOCK_LOCZ)==0)
- ob->loc[2]= ob->dloc[2]= 0.0f;
+ if ((ob->protectflag & OB_LOCK_LOCX) == 0)
+ ob->loc[0] = ob->dloc[0] = 0.0f;
+ if ((ob->protectflag & OB_LOCK_LOCY) == 0)
+ ob->loc[1] = ob->dloc[1] = 0.0f;
+ if ((ob->protectflag & OB_LOCK_LOCZ) == 0)
+ ob->loc[2] = ob->dloc[2] = 0.0f;
}
/* clear rotation of object */
static void object_clear_rot(Object *ob)
{
/* clear rotations that aren't locked */
- if (ob->protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) {
+ if (ob->protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) {
if (ob->protectflag & OB_LOCK_ROT4D) {
/* perform clamping on a component by component basis */
if (ob->rotmode == ROT_MODE_AXISANGLE) {
if ((ob->protectflag & OB_LOCK_ROTW) == 0)
- ob->rotAngle= ob->drotAngle= 0.0f;
+ ob->rotAngle = ob->drotAngle = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTX) == 0)
- ob->rotAxis[0]= ob->drotAxis[0]= 0.0f;
+ ob->rotAxis[0] = ob->drotAxis[0] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTY) == 0)
- ob->rotAxis[1]= ob->drotAxis[1]= 0.0f;
+ ob->rotAxis[1] = ob->drotAxis[1] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
- ob->rotAxis[2]= ob->drotAxis[2]= 0.0f;
+ ob->rotAxis[2] = ob->drotAxis[2] = 0.0f;
/* check validity of axis - axis should never be 0,0,0 (if so, then we make it rotate about y) */
if (IS_EQF(ob->rotAxis[0], ob->rotAxis[1]) && IS_EQF(ob->rotAxis[1], ob->rotAxis[2]))
ob->rotAxis[1] = 1.0f;
if (IS_EQF(ob->drotAxis[0], ob->drotAxis[1]) && IS_EQF(ob->drotAxis[1], ob->drotAxis[2]))
- ob->drotAxis[1]= 1.0f;
+ ob->drotAxis[1] = 1.0f;
}
else if (ob->rotmode == ROT_MODE_QUAT) {
if ((ob->protectflag & OB_LOCK_ROTW) == 0)
- ob->quat[0]= ob->dquat[0]= 1.0f;
+ ob->quat[0] = ob->dquat[0] = 1.0f;
if ((ob->protectflag & OB_LOCK_ROTX) == 0)
- ob->quat[1]= ob->dquat[1]= 0.0f;
+ ob->quat[1] = ob->dquat[1] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTY) == 0)
- ob->quat[2]= ob->dquat[2]= 0.0f;
+ ob->quat[2] = ob->dquat[2] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
- ob->quat[3]= ob->dquat[3]= 0.0f;
+ ob->quat[3] = ob->dquat[3] = 0.0f;
// TODO: does this quat need normalizing now?
}
else {
/* the flag may have been set for the other modes, so just ignore the extra flag... */
if ((ob->protectflag & OB_LOCK_ROTX) == 0)
- ob->rot[0]= ob->drot[0]= 0.0f;
+ ob->rot[0] = ob->drot[0] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTY) == 0)
- ob->rot[1]= ob->drot[1]= 0.0f;
+ ob->rot[1] = ob->drot[1] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
- ob->rot[2]= ob->drot[2]= 0.0f;
+ ob->rot[2] = ob->drot[2] = 0.0f;
}
}
else {
@@ -147,30 +147,30 @@ static void object_clear_rot(Object *ob)
copy_v3_v3(oldeul, ob->rot);
}
- eul[0]= eul[1]= eul[2]= 0.0f;
+ eul[0] = eul[1] = eul[2] = 0.0f;
if (ob->protectflag & OB_LOCK_ROTX)
- eul[0]= oldeul[0];
+ eul[0] = oldeul[0];
if (ob->protectflag & OB_LOCK_ROTY)
- eul[1]= oldeul[1];
+ eul[1] = oldeul[1];
if (ob->protectflag & OB_LOCK_ROTZ)
- eul[2]= oldeul[2];
+ eul[2] = oldeul[2];
if (ob->rotmode == ROT_MODE_QUAT) {
eul_to_quat(ob->quat, eul);
/* quaternions flip w sign to accumulate rotations correctly */
- if ((quat1[0]<0.0f && ob->quat[0]>0.0f) || (quat1[0]>0.0f && ob->quat[0]<0.0f)) {
+ if ((quat1[0] < 0.0f && ob->quat[0] > 0.0f) || (quat1[0] > 0.0f && ob->quat[0] < 0.0f)) {
mul_qt_fl(ob->quat, -1.0f);
}
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- eulO_to_axis_angle(ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT);
+ eulO_to_axis_angle(ob->rotAxis, &ob->rotAngle, eul, EULER_ORDER_DEFAULT);
}
else {
copy_v3_v3(ob->rot, eul);
}
}
- } // Duplicated in source/blender/editors/armature/editarmature.c
+ } // Duplicated in source/blender/editors/armature/editarmature.c
else {
if (ob->rotmode == ROT_MODE_QUAT) {
unit_qt(ob->quat);
@@ -191,17 +191,17 @@ static void object_clear_rot(Object *ob)
static void object_clear_scale(Object *ob)
{
/* clear scale factors which are not locked */
- if ((ob->protectflag & OB_LOCK_SCALEX)==0) {
- ob->dscale[0]= 1.0f;
- ob->size[0]= 1.0f;
+ if ((ob->protectflag & OB_LOCK_SCALEX) == 0) {
+ ob->dscale[0] = 1.0f;
+ ob->size[0] = 1.0f;
}
- if ((ob->protectflag & OB_LOCK_SCALEY)==0) {
- ob->dscale[1]= 1.0f;
- ob->size[1]= 1.0f;
+ if ((ob->protectflag & OB_LOCK_SCALEY) == 0) {
+ ob->dscale[1] = 1.0f;
+ ob->size[1] = 1.0f;
}
- if ((ob->protectflag & OB_LOCK_SCALEZ)==0) {
- ob->dscale[2]= 1.0f;
- ob->size[2]= 1.0f;
+ if ((ob->protectflag & OB_LOCK_SCALEZ) == 0) {
+ ob->dscale[2] = 1.0f;
+ ob->size[2] = 1.0f;
}
}
@@ -209,10 +209,10 @@ static void object_clear_scale(Object *ob)
/* generic exec for clear-transform operators */
static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
- void (*clear_func)(Object*), const char default_ksName[])
+ void (*clear_func)(Object *), const char default_ksName[])
{
Main *bmain = CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
/* sanity checks */
@@ -227,8 +227,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
/* operate on selected objects only if they aren't in weight-paint mode
* (so that object-transform clearing won't be applied at same time as bone-clearing)
*/
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) {
/* run provided clearing function */
clear_func(ob);
@@ -244,7 +243,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
/* this is needed so children are also updated */
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -269,7 +268,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_rotation_clear_exec(bContext *C, wmOperator *op)
@@ -289,7 +288,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_scale_clear_exec(bContext *C, wmOperator *op)
@@ -309,23 +308,22 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* --------------- */
static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
float *v1, *v3;
float mat[3][3];
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent) {
/* vectors pointed to by v1 and v3 will get modified */
- v1= ob->loc;
- v3= ob->parentinv[3];
+ v1 = ob->loc;
+ v3 = ob->parentinv[3];
copy_m3_m4(mat, ob->parentinv);
negate_v3_v3(v3, v1);
@@ -338,7 +336,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -355,20 +353,20 @@ void OBJECT_OT_origin_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/*************************** Apply Transformation ****************************/
/* use this when the loc/size/rot of the parent has changed but the children
- * should stay in the same place, e.g. for apply-size-rot or object center */
-static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
+* should stay in the same place, e.g. for apply-size-rot or object center */
+static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob)
{
Object workob;
Object *ob_child;
/* a change was made, adjust the children to compensate */
- for (ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
+ for (ob_child = bmain->object.first; ob_child; ob_child = ob_child->id.next) {
if (ob_child->parent == ob) {
object_apply_mat4(ob_child, ob_child->obmat, TRUE, FALSE);
what_does_parent(scene, ob_child, &workob);
@@ -379,21 +377,21 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_rot, int apply_scale)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
float rsmat[3][3], tmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
int a, change = 0;
/* first check if we can execute */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
if (ID_REAL_USERS(ob->data) > 1) {
BKE_report(reports, RPT_ERROR, "Can't apply to a multi user mesh, doing nothing");
return OPERATOR_CANCELLED;
}
}
- else if (ob->type==OB_ARMATURE) {
+ else if (ob->type == OB_ARMATURE) {
if (ID_REAL_USERS(ob->data) > 1) {
BKE_report(reports, RPT_ERROR, "Can't apply to a multi user armature, doing nothing");
return OPERATOR_CANCELLED;
@@ -413,7 +411,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
return OPERATOR_CANCELLED;
}
- cu= ob->data;
+ cu = ob->data;
if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2d curve, doing nothing");
@@ -428,7 +426,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
CTX_DATA_END;
/* now execute */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
/* calculate rotation/scale matrix */
if (apply_scale && apply_rot)
@@ -466,24 +464,24 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
/* apply to object data */
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
MVert *mvert;
multiresModifier_scale_disp(scene, ob);
/* adjust data */
- mvert= me->mvert;
- for (a=0; a<me->totvert; a++, mvert++)
+ mvert = me->mvert;
+ for (a = 0; a < me->totvert; a++, mvert++)
mul_m4_v3(mat, mvert->co);
if (me->key) {
KeyBlock *kb;
- for (kb=me->key->block.first; kb; kb=kb->next) {
- float *fp= kb->data;
+ for (kb = me->key->block.first; kb; kb = kb->next) {
+ float *fp = kb->data;
- for (a=0; a<kb->totelem; a++, fp+=3)
+ for (a = 0; a < kb->totelem; a++, fp += 3)
mul_m4_v3(mat, fp);
}
}
@@ -491,7 +489,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
/* update normals */
mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
}
- else if (ob->type==OB_ARMATURE) {
+ else if (ob->type == OB_ARMATURE) {
ED_armature_apply_transform(ob, mat);
}
else if (ob->type == OB_LATTICE) {
@@ -505,7 +503,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- Curve *cu= ob->data;
+ Curve *cu = ob->data;
Nurb *nu;
BPoint *bp;
@@ -513,20 +511,20 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
scale = mat3_to_scale(rsmat);
- for (nu=cu->nurb.first; nu; nu=nu->next) {
+ for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- a= nu->pntsu;
- for (bezt= nu->bezt; a--; bezt++) {
+ a = nu->pntsu;
+ for (bezt = nu->bezt; a--; bezt++) {
mul_m4_v3(mat, bezt->vec[0]);
mul_m4_v3(mat, bezt->vec[1]);
mul_m4_v3(mat, bezt->vec[2]);
bezt->radius *= scale;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else {
- a= nu->pntsu*nu->pntsv;
- for (bp= nu->bp; a--; bp++)
+ a = nu->pntsu * nu->pntsv;
+ for (bp = nu->bp; a--; bp++)
mul_m4_v3(mat, bp->vec);
}
}
@@ -537,7 +535,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
if (apply_loc)
zero_v3(ob->loc);
if (apply_scale)
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0f;
+ ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
if (apply_rot) {
zero_v3(ob->rot);
unit_qt(ob->quat);
@@ -545,13 +543,13 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
where_is_object(scene, ob);
- if (ob->type==OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
where_is_pose(scene, ob); /* needed for bone parents */
}
ignore_parent_tx(bmain, scene, ob);
- DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
change = 1;
}
@@ -560,16 +558,16 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
if (!change)
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
int change = 0;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
where_is_object(scene, ob);
object_apply_mat4(ob, ob->obmat, TRUE, TRUE);
where_is_object(scene, ob);
@@ -584,7 +582,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
if (!change)
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -600,14 +598,14 @@ void OBJECT_OT_visual_transform_apply(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_transform_apply_exec(bContext *C, wmOperator *op)
{
- const int loc= RNA_boolean_get(op->ptr, "location");
- const int rot= RNA_boolean_get(op->ptr, "rotation");
- const int sca= RNA_boolean_get(op->ptr, "scale");
+ const int loc = RNA_boolean_get(op->ptr, "location");
+ const int rot = RNA_boolean_get(op->ptr, "rotation");
+ const int sca = RNA_boolean_get(op->ptr, "scale");
if (loc || rot || sca) {
return apply_objects_internal(C, op->reports, loc, rot, sca);
@@ -629,7 +627,7 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "location", 0, "Location", "");
RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", "");
@@ -639,23 +637,23 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
/********************* Set Object Center ************************/
enum {
- GEOMETRY_TO_ORIGIN=0,
+ GEOMETRY_TO_ORIGIN = 0,
ORIGIN_TO_GEOMETRY,
ORIGIN_TO_CURSOR
};
static int object_origin_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
Object *tob;
float cursor[3], cent[3], cent_neg[3], centn[3], min[3], max[3];
int centermode = RNA_enum_get(op->ptr, "type");
int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */
/* keep track of what is changed */
- int tot_change=0, tot_lib_error=0, tot_multiuser_arm_error=0;
+ int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
if (obedit && centermode != GEOMETRY_TO_ORIGIN) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
@@ -663,10 +661,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
/* get the view settings if 'around' isn't set and the view is available */
- View3D *v3d= CTX_wm_view3d(C);
+ View3D *v3d = CTX_wm_view3d(C);
copy_v3_v3(cursor, give_cursor(scene, v3d));
if (v3d && !RNA_struct_property_is_set(op->ptr, "center"))
- around= v3d->around;
+ around = v3d->around;
}
zero_v3(cent);
@@ -674,8 +672,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (obedit) {
INIT_MINMAX(min, max);
- if (obedit->type==OB_MESH) {
- Mesh *me= obedit->data;
+ if (obedit->type == OB_MESH) {
+ Mesh *me = obedit->data;
BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMIter iter;
@@ -688,10 +686,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- if (around==V3D_CENTROID) {
+ if (around == V3D_CENTROID) {
total++;
add_v3_v3(cent, eve->co);
- mul_v3_fl(cent, 1.0f/(float)total);
+ mul_v3_fl(cent, 1.0f / (float)total);
}
else {
DO_MINMAX(eve->co, min, max);
@@ -707,24 +705,24 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
EDBM_mesh_normals_update(em);
tot_change++;
DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
- }
+ }
}
/* reset flags */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- ob->flag &= ~OB_DONE;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ ob->flag &= ~OB_DONE;
}
CTX_DATA_END;
- for (tob= bmain->object.first; tob; tob= tob->id.next) {
+ for (tob = bmain->object.first; tob; tob = tob->id.next) {
if (tob->data)
((ID *)tob->data)->flag &= ~LIB_DOIT;
if (tob->dup_group)
((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
}
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if ((ob->flag & OB_DONE)==0) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if ((ob->flag & OB_DONE) == 0) {
int do_inverse_offset = FALSE;
ob->flag |= OB_DONE;
@@ -736,7 +734,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (ob->data == NULL) {
/* special support for dupligroups */
- if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT)==0) {
+ if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT) == 0) {
if (ob->dup_group->id.lib) {
tot_lib_error++;
}
@@ -755,7 +753,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_change++;
ob->dup_group->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
}
}
}
@@ -763,11 +761,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_lib_error++;
}
- if (obedit==NULL && ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (obedit == NULL && ob->type == OB_MESH) {
+ Mesh *me = ob->data;
if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if (around==V3D_CENTROID) { mesh_center_median(me, cent); }
+ else if (around == V3D_CENTROID) { mesh_center_median(me, cent); }
else { mesh_center_bounds(me, cent); }
negate_v3_v3(cent_neg, cent);
@@ -775,25 +773,25 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_change++;
me->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- Curve *cu= ob->data;
+ Curve *cu = ob->data;
if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if (around==V3D_CENTROID) { curve_center_median(cu, cent); }
- else { curve_center_bounds(cu, cent); }
+ else if (around == V3D_CENTROID) { BKE_curve_center_median(cu, cent); }
+ else { BKE_curve_center_bounds(cu, cent); }
/* don't allow Z change if curve is 2D */
if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D))
cent[2] = 0.0;
negate_v3_v3(cent_neg, cent);
- curve_translate(cu, cent_neg, 1);
+ BKE_curve_translate(cu, cent_neg, 1);
tot_change++;
cu->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
if (obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
@@ -802,12 +800,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
break;
}
}
- else if (ob->type==OB_FONT) {
+ else if (ob->type == OB_FONT) {
/* get from bb */
- Curve *cu= ob->data;
+ Curve *cu = ob->data;
- if (cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) {
+ if (cu->bb == NULL && (centermode != ORIGIN_TO_CURSOR)) {
/* do nothing*/
}
else {
@@ -815,21 +813,21 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
/* done */
}
else {
- cent[0]= 0.5f * ( cu->bb->vec[4][0] + cu->bb->vec[0][0]);
- cent[1]= 0.5f * ( cu->bb->vec[0][1] + cu->bb->vec[2][1]) - 0.5f; /* extra 0.5 is the height o above line */
+ cent[0] = 0.5f * (cu->bb->vec[4][0] + cu->bb->vec[0][0]);
+ cent[1] = 0.5f * (cu->bb->vec[0][1] + cu->bb->vec[2][1]) - 0.5f; /* extra 0.5 is the height o above line */
}
- cent[2]= 0.0f;
+ cent[2] = 0.0f;
- cu->xof= cu->xof - (cent[0] / cu->fsize);
- cu->yof= cu->yof - (cent[1] / cu->fsize);
+ cu->xof = cu->xof - (cent[0] / cu->fsize);
+ cu->yof = cu->yof - (cent[1] / cu->fsize);
tot_change++;
cu->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
}
}
- else if (ob->type==OB_ARMATURE) {
+ else if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
if (ID_REAL_USERS(arm) > 1) {
@@ -862,15 +860,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
MetaBall *mb = ob->data;
if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if (around==V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
- else { BKE_metaball_center_bounds(mb, cent); }
+ else if (around == V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
+ else { BKE_metaball_center_bounds(mb, cent); }
negate_v3_v3(cent_neg, cent);
BKE_metaball_translate(mb, cent_neg);
tot_change++;
mb->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
if (obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
@@ -889,27 +887,28 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
add_v3_v3(ob->loc, centn);
where_is_object(scene, ob);
- if (ob->type==OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
where_is_pose(scene, ob); /* needed for bone parents */
}
ignore_parent_tx(bmain, scene, ob);
/* other users? */
- CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) {
- if ( (ob_other->flag & OB_DONE)==0 &&
- ( (ob->data && (ob->data == ob_other->data)) ||
- (ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) )
- ) {
+ CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects) {
+ if ((ob_other->flag & OB_DONE) == 0 &&
+ ((ob->data && (ob->data == ob_other->data)) ||
+ (ob->dup_group == ob_other->dup_group &&
+ (ob->transflag | ob_other->transflag) & OB_DUPLIGROUP)))
+ {
ob_other->flag |= OB_DONE;
- DAG_id_tag_update(&ob_other->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&ob_other->id, OB_RECALC_OB | OB_RECALC_DATA);
copy_v3_v3(centn, cent);
mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */
add_v3_v3(ob_other->loc, centn);
where_is_object(scene, ob_other);
- if (ob_other->type==OB_ARMATURE) {
+ if (ob_other->type == OB_ARMATURE) {
where_is_pose(scene, ob_other); /* needed for bone parents */
}
ignore_parent_tx(bmain, scene, ob_other);
@@ -921,22 +920,22 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- for (tob= bmain->object.first; tob; tob= tob->id.next)
+ for (tob = bmain->object.first; tob; tob = tob->id.next)
if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
- DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA);
if (tot_change) {
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
}
/* Warn if any errors occurred */
- if (tot_lib_error+tot_multiuser_arm_error) {
- BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:",tot_lib_error+tot_multiuser_arm_error, tot_change);
+ if (tot_lib_error + tot_multiuser_arm_error) {
+ BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:", tot_lib_error + tot_multiuser_arm_error, tot_change);
if (tot_lib_error)
- BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects",tot_lib_error);
+ BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects", tot_lib_error);
if (tot_multiuser_arm_error)
- BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)",tot_multiuser_arm_error);
+ BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)", tot_multiuser_arm_error);
}
return OPERATOR_FINISHED;
@@ -969,7 +968,7 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", "");
RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", "");
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index ea0b7542886..744f8adb59f 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -85,9 +85,9 @@ static void vgroup_delete_all(Object *ob);
static Lattice *vgroup_edit_lattice(Object *ob)
{
- Lattice *lt= ob->data;
- BLI_assert(ob->type==OB_LATTICE);
- return (lt->editlatt)? lt->editlatt->latt: lt;
+ Lattice *lt = ob->data;
+ BLI_assert(ob->type == OB_LATTICE);
+ return (lt->editlatt) ? lt->editlatt->latt : lt;
}
int ED_vgroup_object_is_edit_mode(Object *ob)
@@ -95,7 +95,7 @@ int ED_vgroup_object_is_edit_mode(Object *ob)
if (ob->type == OB_MESH)
return (BMEdit_FromObject(ob) != NULL);
else if (ob->type == OB_LATTICE)
- return (((Lattice*)ob->data)->editlatt != NULL);
+ return (((Lattice *)ob->data)->editlatt != NULL);
return 0;
}
@@ -145,18 +145,18 @@ void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup)
void ED_vgroup_clear(Object *ob)
{
- bDeformGroup *dg= (bDeformGroup *)ob->defbase.first;
- int edit_mode= ED_vgroup_object_is_edit_mode(ob);
+ bDeformGroup *dg = (bDeformGroup *)ob->defbase.first;
+ int edit_mode = ED_vgroup_object_is_edit_mode(ob);
while (dg) {
- bDeformGroup *next_dg= dg->next;
+ bDeformGroup *next_dg = dg->next;
if (edit_mode)
vgroup_delete_edit_mode(ob, dg);
else
vgroup_delete_object_mode(ob, dg);
- dg= next_dg;
+ dg = next_dg;
}
}
@@ -164,14 +164,14 @@ int ED_vgroup_data_create(ID *id)
{
/* create deform verts */
- if (GS(id->name)==ID_ME) {
- Mesh *me= (Mesh *)id;
- me->dvert= CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
+ if (GS(id->name) == ID_ME) {
+ Mesh *me = (Mesh *)id;
+ me->dvert = CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
return TRUE;
}
- else if (GS(id->name)==ID_LT) {
- Lattice *lt= (Lattice *)id;
- lt->dvert= MEM_callocN(sizeof(MDeformVert)*lt->pntsu*lt->pntsv*lt->pntsw, "lattice deformVert");
+ else if (GS(id->name) == ID_LT) {
+ Lattice *lt = (Lattice *)id;
+ lt->dvert = MEM_callocN(sizeof(MDeformVert) * lt->pntsu * lt->pntsv * lt->pntsw, "lattice deformVert");
return TRUE;
}
else {
@@ -185,7 +185,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
*dvert_arr = NULL;
if (id) {
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
{
Mesh *me = (Mesh *)id;
@@ -202,7 +202,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
i = em->bm->totvert;
- *dvert_arr= MEM_mallocN(sizeof(void*)*i, "vgroup parray from me");
+ *dvert_arr = MEM_mallocN(sizeof(void *) * i, "vgroup parray from me");
*dvert_tot = i;
i = 0;
@@ -223,21 +223,21 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
return 1;
}
else if (me->dvert) {
- MVert *mvert= me->mvert;
- MDeformVert *dvert= me->dvert;
+ MVert *mvert = me->mvert;
+ MDeformVert *dvert = me->dvert;
int i;
- *dvert_tot= me->totvert;
- *dvert_arr= MEM_mallocN(sizeof(void*)*me->totvert, "vgroup parray from me");
+ *dvert_tot = me->totvert;
+ *dvert_arr = MEM_mallocN(sizeof(void *) * me->totvert, "vgroup parray from me");
if (use_vert_sel) {
- for (i=0; i<me->totvert; i++) {
+ for (i = 0; i < me->totvert; i++) {
(*dvert_arr)[i] = (mvert[i].flag & SELECT) ?
- &dvert[i] : NULL;
+ &dvert[i] : NULL;
}
}
else {
- for (i=0; i<me->totvert; i++) {
+ for (i = 0; i < me->totvert; i++) {
(*dvert_arr)[i] = me->dvert + i;
}
}
@@ -250,24 +250,24 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
}
case ID_LT:
{
- int i=0;
+ int i = 0;
- Lattice *lt= (Lattice *)id;
- lt= (lt->editlatt)? lt->editlatt->latt: lt;
+ Lattice *lt = (Lattice *)id;
+ lt = (lt->editlatt) ? lt->editlatt->latt : lt;
if (lt->dvert) {
- BPoint *def= lt->def;
- *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
- *dvert_arr= MEM_mallocN(sizeof(void*)*(*dvert_tot), "vgroup parray from me");
+ BPoint *def = lt->def;
+ *dvert_tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ *dvert_arr = MEM_mallocN(sizeof(void *) * (*dvert_tot), "vgroup parray from me");
if (use_vert_sel) {
- for (i=0; i<*dvert_tot; i++) {
+ for (i = 0; i < *dvert_tot; i++) {
(*dvert_arr)[i] = (def->f1 & SELECT) ?
&lt->dvert[i] : NULL;
}
}
else {
- for (i=0; i<*dvert_tot; i++) {
+ for (i = 0; i < *dvert_tot; i++) {
(*dvert_arr)[i] = lt->dvert + i;
}
}
@@ -288,27 +288,27 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
{
if (id) {
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
{
Mesh *me = (Mesh *)id;
- *dvert_arr= me->dvert;
- *dvert_tot= me->totvert;
+ *dvert_arr = me->dvert;
+ *dvert_tot = me->totvert;
return TRUE;
}
case ID_LT:
{
- Lattice *lt= (Lattice *)id;
- lt= (lt->editlatt)? lt->editlatt->latt: lt;
- *dvert_arr= lt->dvert;
- *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ Lattice *lt = (Lattice *)id;
+ lt = (lt->editlatt) ? lt->editlatt->latt : lt;
+ *dvert_arr = lt->dvert;
+ *dvert_tot = lt->pntsu * lt->pntsv * lt->pntsw;
return TRUE;
}
}
}
- *dvert_arr= NULL;
- *dvert_tot= 0;
+ *dvert_arr = NULL;
+ *dvert_tot = 0;
return FALSE;
}
@@ -318,9 +318,9 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
MDeformVert **dvert_array_from, **dvf;
MDeformVert **dvert_array, **dv;
int dvert_tot_from, dvert_tot, i;
- int defbase_tot_from= BLI_countlist(&ob_from->defbase);
- int defbase_tot= BLI_countlist(&ob->defbase);
- short new_vgroup= FALSE;
+ int defbase_tot_from = BLI_countlist(&ob_from->defbase);
+ int defbase_tot = BLI_countlist(&ob->defbase);
+ short new_vgroup = FALSE;
/*get vertex groups arrays*/
ED_vgroup_give_parray(ob_from->data, &dvert_array_from, &dvert_tot_from, FALSE);
@@ -328,10 +328,10 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
if ((dvert_array == NULL) && (dvert_array_from != NULL) && ED_vgroup_data_create(ob->data)) {
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
- new_vgroup= TRUE;
+ new_vgroup = TRUE;
}
- if (ob==ob_from || dvert_tot==0 || (dvert_tot != dvert_tot_from) || dvert_array_from==NULL || dvert_array==NULL) {
+ if (ob == ob_from || dvert_tot == 0 || (dvert_tot != dvert_tot_from) || dvert_array_from == NULL || dvert_array == NULL) {
if (dvert_array) MEM_freeN(dvert_array);
if (dvert_array_from) MEM_freeN(dvert_array_from);
@@ -345,29 +345,29 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
/* do the copy */
BLI_freelistN(&ob->defbase);
BLI_duplicatelist(&ob->defbase, &ob_from->defbase);
- ob->actdef= ob_from->actdef;
+ ob->actdef = ob_from->actdef;
if (defbase_tot_from < defbase_tot) {
/* correct vgroup indices because the number of vgroups is being reduced. */
- int *remap= MEM_mallocN(sizeof(int) * (defbase_tot + 1), __func__);
- for (i=0; i <= defbase_tot_from; i++) remap[i]= i;
- for (; i <= defbase_tot; i++) remap[i]= 0; /* can't use these, so disable */
+ int *remap = MEM_mallocN(sizeof(int) * (defbase_tot + 1), __func__);
+ for (i = 0; i <= defbase_tot_from; i++) remap[i] = i;
+ for (; i <= defbase_tot; i++) remap[i] = 0; /* can't use these, so disable */
vgroup_remap_update_users(ob, remap);
MEM_freeN(remap);
}
- dvf= dvert_array_from;
- dv= dvert_array;
+ dvf = dvert_array_from;
+ dv = dvert_array;
- for (i=0; i<dvert_tot; i++, dvf++, dv++) {
+ for (i = 0; i < dvert_tot; i++, dvf++, dv++) {
if ((*dv)->dw)
MEM_freeN((*dv)->dw);
- *(*dv)= *(*dvf);
+ *(*dv) = *(*dvf);
if ((*dv)->dw)
- (*dv)->dw= MEM_dupallocN((*dv)->dw);
+ (*dv)->dw = MEM_dupallocN((*dv)->dw);
}
MEM_freeN(dvert_array);
@@ -589,13 +589,13 @@ static void ED_vgroup_nr_vert_add(Object *ob,
/* add the vert to the deform group with the
* specified number
*/
- MDeformVert *dvert= NULL;
- int tot;
+ MDeformVert *dvert = NULL;
+ int tot;
/* get the vert */
ED_vgroup_give_array(ob->data, &dvert, &tot);
- if (dvert==NULL)
+ if (dvert == NULL)
return;
/* check that vertnum is valid before trying to get the relevant dvert */
@@ -604,7 +604,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
if (dvert) {
- MDeformVert *dv= &dvert[vertnum];
+ MDeformVert *dv = &dvert[vertnum];
MDeformWeight *dw;
/* Lets first check to see if this vert is
@@ -612,27 +612,27 @@ static void ED_vgroup_nr_vert_add(Object *ob,
* lets update it
*/
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
if (dw) {
- switch(assignmode) {
- case WEIGHT_REPLACE:
- dw->weight = weight;
- break;
- case WEIGHT_ADD:
- dw->weight += weight;
- if (dw->weight >= 1.0f)
- dw->weight = 1.0f;
- break;
- case WEIGHT_SUBTRACT:
- dw->weight -= weight;
- /* if the weight is zero or less then
- * remove the vert from the deform group
- */
- if (dw->weight <= 0.0f) {
- defvert_remove_group(dv, dw);
- }
- break;
+ switch (assignmode) {
+ case WEIGHT_REPLACE:
+ dw->weight = weight;
+ break;
+ case WEIGHT_ADD:
+ dw->weight += weight;
+ if (dw->weight >= 1.0f)
+ dw->weight = 1.0f;
+ break;
+ case WEIGHT_SUBTRACT:
+ dw->weight -= weight;
+ /* if the weight is zero or less then
+ * remove the vert from the deform group
+ */
+ if (dw->weight <= 0.0f) {
+ defvert_remove_group(dv, dw);
+ }
+ break;
}
}
else {
@@ -640,21 +640,21 @@ static void ED_vgroup_nr_vert_add(Object *ob,
* we must take a different form of action ...
*/
- switch(assignmode) {
- case WEIGHT_SUBTRACT:
- /* if we are subtracting then we don't
- * need to do anything
- */
- return;
+ switch (assignmode) {
+ case WEIGHT_SUBTRACT:
+ /* if we are subtracting then we don't
+ * need to do anything
+ */
+ return;
- case WEIGHT_REPLACE:
- case WEIGHT_ADD:
- /* if we are doing an additive assignment, then
- * we need to create the deform weight
- */
+ case WEIGHT_REPLACE:
+ case WEIGHT_ADD:
+ /* if we are doing an additive assignment, then
+ * we need to create the deform weight
+ */
- /* we checked if the vertex was added before so no need to test again, simply add */
- defvert_add_index_notest(dv, def_nr, weight);
+ /* we checked if the vertex was added before so no need to test again, simply add */
+ defvert_add_index_notest(dv, def_nr, weight);
}
}
}
@@ -666,9 +666,9 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
/* add the vert to the deform group with the
* specified assign mode
*/
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
- MDeformVert *dv= NULL;
+ MDeformVert *dv = NULL;
int tot;
/* get the deform group number, exit if
@@ -678,7 +678,7 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
/* if there's no deform verts then create some,
*/
- if (ED_vgroup_give_array(ob->data, &dv, &tot) && dv==NULL)
+ if (ED_vgroup_give_array(ob->data, &dv, &tot) && dv == NULL)
ED_vgroup_data_create(ob->data);
/* call another function to do the work
@@ -687,17 +687,17 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
}
/* mesh object mode, lattice can be in editmode */
-void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
+void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
{
/* This routine removes the vertex from the specified
* deform group.
*/
/* TODO, this is slow in a loop, better pass def_nr directly, but leave for later... - campbell */
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
if (def_nr != -1) {
- MDeformVert *dvert= NULL;
+ MDeformVert *dvert = NULL;
int tot;
/* get the deform vertices corresponding to the
@@ -706,10 +706,10 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
ED_vgroup_give_array(ob->data, &dvert, &tot);
if (dvert) {
- MDeformVert *dv= &dvert[vertnum];
+ MDeformVert *dv = &dvert[vertnum];
MDeformWeight *dw;
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
}
}
@@ -717,20 +717,20 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
{
- MDeformVert *dv= NULL;
+ MDeformVert *dv = NULL;
BMVert *eve;
Mesh *me;
/* get the deform vertices corresponding to the vertnum */
- if (ob->type==OB_MESH) {
- me= ob->data;
+ if (ob->type == OB_MESH) {
+ me = ob->data;
if (me->edit_btmesh) {
- eve= BM_vert_at_index(me->edit_btmesh->bm, vertnum);
+ eve = BM_vert_at_index(me->edit_btmesh->bm, vertnum);
if (!eve) {
return 0.0f;
}
- dv= CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dv = CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
}
else {
if (vertnum >= me->totvert) {
@@ -739,11 +739,11 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
dv = &me->dvert[vertnum];
}
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
- if (vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
+ if (vertnum >= lt->pntsu * lt->pntsv * lt->pntsw) {
return 0.0f;
}
dv = &lt->dvert[vertnum];
@@ -751,7 +751,7 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
}
if (dv) {
- MDeformWeight *dw= defvert_find_index(dv, def_nr);
+ MDeformWeight *dw = defvert_find_index(dv, def_nr);
if (dw) {
return dw->weight;
}
@@ -762,7 +762,7 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
{
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
if (def_nr == -1) {
return -1;
@@ -772,8 +772,8 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
}
void ED_vgroup_select_by_name(Object *ob, const char *name)
-{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
- ob->actdef= defgroup_name_index(ob, name) + 1;
+{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
+ ob->actdef = defgroup_name_index(ob, name) + 1;
}
/********************** Operator Implementations *********************/
@@ -781,7 +781,7 @@ void ED_vgroup_select_by_name(Object *ob, const char *name)
/* only in editmode */
static void vgroup_select_verts(Object *ob, int select)
{
- const int def_nr= ob->actdef-1;
+ const int def_nr = ob->actdef - 1;
MDeformVert *dv;
if (!BLI_findlink(&ob->defbase, def_nr)) {
@@ -789,7 +789,7 @@ static void vgroup_select_verts(Object *ob, int select)
}
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
@@ -798,7 +798,7 @@ static void vgroup_select_verts(Object *ob, int select)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (defvert_find_index(dv, def_nr)) {
BM_vert_select_set(em->bm, eve, select);
}
@@ -806,7 +806,7 @@ static void vgroup_select_verts(Object *ob, int select)
}
/* this has to be called, because this function operates on vertices only */
- if (select) EDBM_select_flush(em); // vertices to edges/faces
+ if (select) EDBM_select_flush(em); // vertices to edges/faces
else EDBM_deselect_flush(em);
}
else {
@@ -818,11 +818,11 @@ static void vgroup_select_verts(Object *ob, int select)
mv = me->mvert;
dv = me->dvert;
- for (i=0; i<me->totvert; i++, mv++, dv++) {
+ for (i = 0; i < me->totvert; i++, mv++, dv++) {
if (!(mv->flag & ME_HIDE)) {
if (defvert_find_index(dv, def_nr)) {
- if (select) mv->flag |= SELECT;
- else mv->flag &= ~SELECT;
+ if (select) mv->flag |= SELECT;
+ else mv->flag &= ~SELECT;
}
}
}
@@ -832,19 +832,19 @@ static void vgroup_select_verts(Object *ob, int select)
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
BPoint *bp;
int a, tot;
- dv= lt->dvert;
+ dv = lt->dvert;
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) {
if (defvert_find_index(dv, def_nr)) {
- if (select) bp->f1 |= SELECT;
- else bp->f1 &= ~SELECT;
+ if (select) bp->f1 |= SELECT;
+ else bp->f1 &= ~SELECT;
}
}
}
@@ -856,10 +856,10 @@ static void vgroup_duplicate(Object *ob)
bDeformGroup *dg, *cdg;
char name[sizeof(dg->name)];
MDeformWeight *dw_org, *dw_cpy;
- MDeformVert **dvert_array=NULL;
- int i, idg, icdg, dvert_tot=0;
+ MDeformVert **dvert_array = NULL;
+ int i, idg, icdg, dvert_tot = 0;
- dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
+ dg = BLI_findlink(&ob->defbase, (ob->actdef - 1));
if (!dg)
return;
@@ -876,16 +876,16 @@ static void vgroup_duplicate(Object *ob)
BLI_addtail(&ob->defbase, cdg);
- idg = (ob->actdef-1);
+ idg = (ob->actdef - 1);
ob->actdef = BLI_countlist(&ob->defbase);
- icdg = (ob->actdef-1);
+ icdg = (ob->actdef - 1);
/* TODO, we might want to allow only copy selected verts here? - campbell */
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
if (dvert_array) {
for (i = 0; i < dvert_tot; i++) {
- MDeformVert *dv= dvert_array[i];
+ MDeformVert *dv = dvert_array[i];
dw_org = defvert_find_index(dv, idg);
if (dw_org) {
/* defvert_verify_index re-allocs org so need to store the weight first */
@@ -901,9 +901,9 @@ static void vgroup_duplicate(Object *ob)
static void vgroup_normalize(Object *ob)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -954,7 +954,7 @@ static void vgroup_normalize(Object *ob)
/* This finds all of the vertices face-connected to vert by an edge and returns a
* MEM_allocated array of indices of size count.
* count is an int passed by reference so it can be assigned the value of the length here. */
-static int* getSurroundingVerts(Mesh *me, int vert, int *count)
+static int *getSurroundingVerts(Mesh *me, int vert, int *count)
{
MPoly *mp = me->mpoly;
int i = me->totpoly;
@@ -981,12 +981,12 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count)
}
else if (!j) {
/* We are on the last corner. */
- a = (ml-1)->v;
+ a = (ml - 1)->v;
b = me->mloop[mp->loopstart].v;
}
else {
- a = (ml-1)->v;
- b = (ml+1)->v;
+ a = (ml - 1)->v;
+ b = (ml + 1)->v;
}
/* Append a and b verts to array, if not yet present. */
@@ -1026,7 +1026,7 @@ static void getSingleCoordinate(MVert *points, int count, float coord[3])
for (i = 0; i < count; i++) {
add_v3_v3(coord, points[i].co);
}
- mul_v3_fl(coord, 1.0f/count);
+ mul_v3_fl(coord, 1.0f / count);
}
/* given a plane and a start and end position,
@@ -1056,7 +1056,7 @@ static void getVerticalAndHorizontalChange(const float norm[3], float d, const f
// I need the derived mesh to be forgotten so the positions are recalculated with weight changes (see dm_deform_recalc)
static void dm_deform_clear(DerivedMesh *dm, Object *ob)
{
- if (ob->derivedDeform && (ob->derivedDeform)==dm) {
+ if (ob->derivedDeform && (ob->derivedDeform) == dm) {
ob->derivedDeform->needsFree = 1;
ob->derivedDeform->release(ob->derivedDeform);
ob->derivedDeform = NULL;
@@ -1068,7 +1068,7 @@ static void dm_deform_clear(DerivedMesh *dm, Object *ob)
}
/* recalculate the deformation */
-static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob)
+static DerivedMesh *dm_deform_recalc(Scene *scene, Object *ob)
{
return mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
}
@@ -1088,19 +1088,19 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
DerivedMesh *dm;
MDeformWeight *dw;
MVert m;
- MDeformVert *dvert = me->dvert+index;
+ MDeformVert *dvert = me->dvert + index;
int totweight = dvert->totweight;
float oldw = 0;
float oldPos[3] = {0};
float vc, hc, dist = 0.0f;
int i, k;
- float (*changes)[2] = MEM_mallocN(sizeof(float *)*totweight*2, "vertHorzChange");
- float *dists = MEM_mallocN(sizeof(float)*totweight, "distance");
+ float (*changes)[2] = MEM_mallocN(sizeof(float *) * totweight * 2, "vertHorzChange");
+ float *dists = MEM_mallocN(sizeof(float) * totweight, "distance");
/* track if up or down moved it closer for each bone */
- int *upDown = MEM_callocN(sizeof(int)*totweight, "upDownTracker");
+ int *upDown = MEM_callocN(sizeof(int) * totweight, "upDownTracker");
- int *dwIndices = MEM_callocN(sizeof(int)*totweight, "dwIndexTracker");
+ int *dwIndices = MEM_callocN(sizeof(int) * totweight, "dwIndexTracker");
float distToStart;
int bestIndex = 0;
char wasChange;
@@ -1115,11 +1115,11 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
distToStart = dot_v3v3(norm, oldPos) + d;
if (distToBe == originalDistToBe) {
- distToBe += distToStart - distToStart*strength;
+ distToBe += distToStart - distToStart * strength;
}
for (i = 0; i < totweight; i++) {
dwIndices[i] = i;
- dw = (dvert->dw+i);
+ dw = (dvert->dw + i);
vc = hc = 0;
if (!dw->weight) {
changes[i][0] = 0;
@@ -1133,10 +1133,10 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
}
oldw = dw->weight;
if (k) {
- dw->weight *= 1+cp;
+ dw->weight *= 1 + cp;
}
else {
- dw->weight /= 1+cp;
+ dw->weight /= 1 + cp;
}
if (dw->weight == oldw) {
changes[i][0] = 0;
@@ -1179,7 +1179,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
float tf;
int ti;
bestIndex = k;
- for (i = k+1; i < totweight; i++) {
+ for (i = k + 1; i < totweight; i++) {
dist = dists[i];
if (fabs(dist) > fabs(dists[i])) {
@@ -1212,7 +1212,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
bestIndex = -1;
// find the best change with an acceptable horizontal change
for (i = 0; i < totweight; i++) {
- if (fabs(changes[i][0]) > fabs(changes[i][1]*2.0f)) {
+ if (fabs(changes[i][0]) > fabs(changes[i][1] * 2.0f)) {
bestIndex = i;
break;
}
@@ -1228,13 +1228,13 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
}
lastIndex = bestIndex;
wasUp = upDown[bestIndex];
- dw = (dvert->dw+dwIndices[bestIndex]);
+ dw = (dvert->dw + dwIndices[bestIndex]);
oldw = dw->weight;
if (upDown[bestIndex]) {
- dw->weight *= 1+cp;
+ dw->weight *= 1 + cp;
}
else {
- dw->weight /= 1+cp;
+ dw->weight /= 1 + cp;
}
if (dw->weight > 1) {
dw->weight = 1;
@@ -1246,8 +1246,9 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
dm_deform_clear(dm, ob); dm = NULL;
}
}
- } while (wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) ==
- (dists[bestIndex]-distToBe)/fabsf(dists[bestIndex]-distToBe));
+ } while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - distToBe) ==
+ (dists[bestIndex] - distToBe) / fabsf(dists[bestIndex] - distToBe)));
+
MEM_freeN(upDown);
MEM_freeN(changes);
MEM_freeN(dists);
@@ -1267,10 +1268,10 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
return;
for (i = 0; i < me->totvert && mvert; i++, mvert++) {
if (mvert->flag & SELECT) {
- int count=0;
+ int count = 0;
if ((verts = getSurroundingVerts(me, i, &count))) {
MVert m;
- MVert *p = MEM_callocN(sizeof(MVert)*(count), "deformedPoints");
+ MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
int k;
DerivedMesh *dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
@@ -1287,7 +1288,7 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
getSingleCoordinate(p, count, coord);
dm->getVert(dm, i, &m);
sub_v3_v3v3(norm, m.co, coord);
- mag= normalize_v3(norm);
+ mag = normalize_v3(norm);
if (mag) { /* zeros fix */
d = -dot_v3v3(norm, coord);
/* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
@@ -1305,9 +1306,9 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
static void vgroup_levels(Object *ob, float offset, float gain)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -1340,9 +1341,9 @@ static void vgroup_levels(Object *ob, float offset, float gain)
/* TODO - select between groups */
static void vgroup_normalize_all(Object *ob, int lock_active)
{
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -1385,17 +1386,17 @@ static void vgroup_lock_all(Object *ob, int action)
bDeformGroup *dg;
if (action == SEL_TOGGLE) {
- action= SEL_SELECT;
- for (dg= ob->defbase.first; dg; dg= dg->next) {
+ action = SEL_SELECT;
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
if (dg->flag & DG_LOCK_WEIGHT) {
- action= SEL_DESELECT;
+ action = SEL_DESELECT;
break;
}
}
}
- for (dg= ob->defbase.first; dg; dg= dg->next) {
- switch(action) {
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
+ switch (action) {
case SEL_SELECT:
dg->flag |= DG_LOCK_WEIGHT;
break;
@@ -1412,9 +1413,9 @@ static void vgroup_lock_all(Object *ob, int action)
static void vgroup_invert(Object *ob, const short auto_assign, const short auto_remove)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
if (!BLI_findlink(&ob->defbase, def_nr)) {
@@ -1432,10 +1433,10 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
}
if (auto_assign) {
- dw= defvert_verify_index(dv, def_nr);
+ dw = defvert_verify_index(dv, def_nr);
}
else {
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
}
if (dw) {
@@ -1455,8 +1456,8 @@ static void vgroup_blend(Object *ob, const float fac)
{
MDeformVert *dv;
MDeformWeight *dw;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef - 1;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
BLI_assert(fac >= 0.0 && fac <= 1.0f);
@@ -1505,14 +1506,14 @@ static void vgroup_blend(Object *ob, const float fac)
int i1 /* , i2 */;
/* i1 is always the selected one */
if (sel1) {
- i1= BM_elem_index_get(eed->v1);
+ i1 = BM_elem_index_get(eed->v1);
/* i2= BM_elem_index_get(eed->v2); */ /* UNUSED */
- eve= eed->v2;
+ eve = eed->v2;
}
else {
/* i2= BM_elem_index_get(eed->v1); */ /* UNUSED */
- i1= BM_elem_index_get(eed->v2);
- eve= eed->v1;
+ i1 = BM_elem_index_get(eed->v2);
+ eve = eed->v1;
}
dv = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MDEFORMVERT);
@@ -1586,9 +1587,9 @@ static void vgroup_blend(Object *ob, const float fac)
static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
if (!BLI_findlink(&ob->defbase, def_nr)) {
@@ -1606,11 +1607,11 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
continue;
}
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
if (dw) {
if (dw->weight <= epsilon) {
- if (keep_single==FALSE || dv->totweight > 1) {
+ if (keep_single == FALSE || dv->totweight > 1) {
defvert_remove_group(dv, dw); /* dw can be NULL */
}
}
@@ -1623,7 +1624,7 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_single)
{
- MDeformVert **dvert_array=NULL;
+ MDeformVert **dvert_array = NULL;
int i, dvert_tot = 0;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -1641,14 +1642,14 @@ static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_sin
continue;
}
- j= dv->totweight;
+ j = dv->totweight;
while (j--) {
if (keep_single && dv->totweight == 1)
break;
- dw= dv->dw + j;
+ dw = dv->dw + j;
if (dw->weight <= epsilon) {
defvert_remove_group(dv, dw);
@@ -1676,14 +1677,14 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
SWAP(MDeformVert, *dvert, *dvert_mirr);
}
else {
- MDeformWeight *dw= defvert_find_index(dvert, act_vgroup);
- MDeformWeight *dw_mirr= defvert_find_index(dvert_mirr, act_vgroup);
+ MDeformWeight *dw = defvert_find_index(dvert, act_vgroup);
+ MDeformWeight *dw_mirr = defvert_find_index(dvert_mirr, act_vgroup);
if (dw || dw_mirr) {
if (dw_mirr == NULL)
- dw_mirr= defvert_verify_index(dvert_mirr, act_vgroup);
+ dw_mirr = defvert_verify_index(dvert_mirr, act_vgroup);
if (dw == NULL)
- dw= defvert_verify_index(dvert, act_vgroup);
+ dw = defvert_verify_index(dvert, act_vgroup);
SWAP(float, dw->weight, dw_mirr->weight);
}
@@ -1733,19 +1734,19 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
BMVert *eve, *eve_mirr;
MDeformVert *dvert, *dvert_mirr;
short sel, sel_mirr;
- int *flip_map, flip_map_len;
- const int def_nr= ob->actdef-1;
+ int *flip_map, flip_map_len;
+ const int def_nr = ob->actdef - 1;
- if ( (mirror_weights==0 && flip_vgroups==0) ||
+ if ( (mirror_weights == 0 && flip_vgroups == 0) ||
(BLI_findlink(&ob->defbase, def_nr) == NULL) )
{
return;
}
if (flip_vgroups) {
- flip_map= all_vgroups ?
- defgroup_flip_map(ob, &flip_map_len, FALSE) :
- defgroup_flip_map_single(ob, &flip_map_len, FALSE, def_nr);
+ flip_map = all_vgroups ?
+ defgroup_flip_map(ob, &flip_map_len, FALSE) :
+ defgroup_flip_map_single(ob, &flip_map_len, FALSE, def_nr);
BLI_assert(flip_map != NULL);
@@ -1755,13 +1756,13 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
}
else {
- flip_map= NULL;
- flip_map_len= 0;
+ flip_map = NULL;
+ flip_map_len = 0;
}
/* only the active group */
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
if (em) {
@@ -1775,13 +1776,13 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
/* Go through the list of editverts and assign them */
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- if ((eve_mirr= EDBM_verts_mirror_get(em, eve))) {
- sel= BM_elem_flag_test(eve, BM_ELEM_SELECT);
- sel_mirr= BM_elem_flag_test(eve_mirr, BM_ELEM_SELECT);
+ if ((eve_mirr = EDBM_verts_mirror_get(em, eve))) {
+ sel = BM_elem_flag_test(eve, BM_ELEM_SELECT);
+ sel_mirr = BM_elem_flag_test(eve_mirr, BM_ELEM_SELECT);
if ((sel || sel_mirr) && (eve != eve_mirr)) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- dvert_mirr= CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert_mirr = CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
if (dvert && dvert_mirr) {
VGROUP_MIRR_OP;
}
@@ -1805,29 +1806,29 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
if (!use_vert_sel) {
- sel= sel_mirr= TRUE;
+ sel = sel_mirr = TRUE;
}
/* tag verts we have used */
- for (vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ for (vidx = 0, mv = me->mvert; vidx < me->totvert; vidx++, mv++) {
mv->flag &= ~ME_VERT_TMP_TAG;
}
- for (vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ for (vidx = 0, mv = me->mvert; vidx < me->totvert; vidx++, mv++) {
if ( ((mv->flag & ME_VERT_TMP_TAG) == 0) &&
- ((vidx_mirr= mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
+ ((vidx_mirr = mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
(vidx != vidx_mirr) &&
- ((((mv_mirr= me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
+ ((((mv_mirr = me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
{
if (use_vert_sel) {
- sel= mv->flag & SELECT;
- sel_mirr= mv_mirr->flag & SELECT;
+ sel = mv->flag & SELECT;
+ sel_mirr = mv_mirr->flag & SELECT;
}
if (sel || sel_mirr) {
- dvert= &me->dvert[vidx];
- dvert_mirr= &me->dvert[vidx_mirr];
+ dvert = &me->dvert[vidx];
+ dvert_mirr = &me->dvert[vidx_mirr];
VGROUP_MIRR_OP;
}
@@ -1839,7 +1840,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
int i1, i2;
int u, v, w;
int pntsu_half;
@@ -1852,27 +1853,27 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
/* unlike editmesh we know that by only looping over the first half of
* the 'u' indices it will cover all points except the middle which is
* ok in this case */
- pntsu_half= lt->pntsu / 2;
+ pntsu_half = lt->pntsu / 2;
- for (w=0; w<lt->pntsw; w++) {
- for (v=0; v<lt->pntsv; v++) {
- for (u=0; u<pntsu_half; u++) {
- int u_inv= (lt->pntsu - 1) - u;
+ for (w = 0; w < lt->pntsw; w++) {
+ for (v = 0; v < lt->pntsv; v++) {
+ for (u = 0; u < pntsu_half; u++) {
+ int u_inv = (lt->pntsu - 1) - u;
if (u != u_inv) {
BPoint *bp, *bp_mirr;
- i1= LT_INDEX(lt, u, v, w);
- i2= LT_INDEX(lt, u_inv, v, w);
+ i1 = LT_INDEX(lt, u, v, w);
+ i2 = LT_INDEX(lt, u_inv, v, w);
- bp= &lt->def[i1];
- bp_mirr= &lt->def[i2];
+ bp = &lt->def[i1];
+ bp_mirr = &lt->def[i2];
- sel= bp->f1 & SELECT;
- sel_mirr= bp_mirr->f1 & SELECT;
+ sel = bp->f1 & SELECT;
+ sel_mirr = bp_mirr->f1 & SELECT;
if (sel || sel_mirr) {
- dvert= &lt->dvert[i1];
- dvert_mirr= &lt->dvert[i2];
+ dvert = &lt->dvert[i1];
+ dvert_mirr = &lt->dvert[i2];
VGROUP_MIRR_OP;
}
@@ -1902,40 +1903,40 @@ static void vgroup_remap_update_users(Object *ob, int *map)
* they get deleted the numbers get out of sync, this corrects that */
if (ob->soft)
- ob->soft->vertgroup= map[ob->soft->vertgroup];
+ ob->soft->vertgroup = map[ob->soft->vertgroup];
- for (md=ob->modifiers.first; md; md=md->next) {
+ for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Explode) {
- emd= (ExplodeModifierData*)md;
- emd->vgroup= map[emd->vgroup];
+ emd = (ExplodeModifierData *)md;
+ emd->vgroup = map[emd->vgroup];
}
else if (md->type == eModifierType_Cloth) {
- clmd= (ClothModifierData*)md;
- clsim= clmd->sim_parms;
+ clmd = (ClothModifierData *)md;
+ clsim = clmd->sim_parms;
if (clsim) {
- clsim->vgroup_mass= map[clsim->vgroup_mass];
- clsim->vgroup_bend= map[clsim->vgroup_bend];
- clsim->vgroup_struct= map[clsim->vgroup_struct];
+ clsim->vgroup_mass = map[clsim->vgroup_mass];
+ clsim->vgroup_bend = map[clsim->vgroup_bend];
+ clsim->vgroup_struct = map[clsim->vgroup_struct];
}
}
}
- for (psys=ob->particlesystem.first; psys; psys=psys->next) {
- for (a=0; a<PSYS_TOT_VG; a++)
- psys->vgroup[a]= map[psys->vgroup[a]];
+ for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+ for (a = 0; a < PSYS_TOT_VG; a++)
+ psys->vgroup[a] = map[psys->vgroup[a]];
}
}
static void vgroup_delete_update_users(Object *ob, int id)
{
- int i, defbase_tot= BLI_countlist(&ob->defbase) + 1;
- int *map= MEM_mallocN(sizeof(int) * defbase_tot, "vgroup del");
+ int i, defbase_tot = BLI_countlist(&ob->defbase) + 1;
+ int *map = MEM_mallocN(sizeof(int) * defbase_tot, "vgroup del");
- map[id]= map[0]= 0;
- for (i=1; i<id; i++) map[i]=i;
- for (i=id+1; i<defbase_tot; i++) map[i]=i-1;
+ map[id] = map[0] = 0;
+ for (i = 1; i < id; i++) map[i] = i;
+ for (i = id + 1; i < defbase_tot; i++) map[i] = i - 1;
vgroup_remap_update_users(ob, map);
MEM_freeN(map);
@@ -1944,9 +1945,9 @@ static void vgroup_delete_update_users(Object *ob, int id)
static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
{
- MDeformVert *dvert_array=NULL;
- int dvert_tot=0;
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ MDeformVert *dvert_array = NULL;
+ int dvert_tot = 0;
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
assert(def_nr > -1);
@@ -1955,10 +1956,10 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
if (dvert_array) {
int i, j;
MDeformVert *dv;
- for (i= 0, dv= dvert_array; i < dvert_tot; i++, dv++) {
+ for (i = 0, dv = dvert_array; i < dvert_tot; i++, dv++) {
MDeformWeight *dw;
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
/* inline, make into a function if anything else needs to do this */
@@ -1980,7 +1981,7 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
if (ob->actdef > def_nr)
ob->actdef--;
if (ob->actdef < 1 && ob->defbase.first)
- ob->actdef= 1;
+ ob->actdef = 1;
}
@@ -1989,10 +1990,10 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGroup *dg)
{
MDeformVert *dv;
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
@@ -2000,7 +2001,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
BMIter iter;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dv && dv->dw && (allverts || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
@@ -2020,7 +2021,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
mv = me->mvert;
dv = me->dvert;
- for (i=0; i<me->totvert; i++, mv++, dv++) {
+ for (i = 0; i < me->totvert; i++, mv++, dv++) {
if (mv->flag & SELECT) {
if (dv->dw && (allverts || (mv->flag & SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
@@ -2031,17 +2032,17 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
BPoint *bp;
- int i, tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ int i, tot = lt->pntsu * lt->pntsv * lt->pntsw;
- for (i=0, bp= lt->def; i<tot; i++, bp++) {
+ for (i = 0, bp = lt->def; i < tot; i++, bp++) {
if (allverts || (bp->f1 & SELECT)) {
MDeformWeight *dw;
- dv= &lt->dvert[i];
+ dv = &lt->dvert[i];
dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
@@ -2054,7 +2055,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
{
int i;
- const int dg_index= BLI_findindex(&ob->defbase, dg);
+ const int dg_index = BLI_findindex(&ob->defbase, dg);
assert(dg_index > -1);
@@ -2062,32 +2063,32 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
vgroup_active_remove_verts(ob, TRUE, dg);
/* Make sure that any verts with higher indices are adjusted accordingly */
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
BMIter iter;
BMVert *eve;
MDeformVert *dvert;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dvert)
- for (i=0; i<dvert->totweight; i++)
+ for (i = 0; i < dvert->totweight; i++)
if (dvert->dw[i].def_nr > dg_index)
dvert->dw[i].def_nr--;
}
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
BPoint *bp;
- MDeformVert *dvert= lt->dvert;
+ MDeformVert *dvert = lt->dvert;
int a, tot;
if (dvert) {
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for (a=0, bp= lt->def; a<tot; a++, bp++, dvert++) {
- for (i=0; i<dvert->totweight; i++) {
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dvert++) {
+ for (i = 0; i < dvert->totweight; i++) {
if (dvert->dw[i].def_nr > dg_index)
dvert->dw[i].def_nr--;
}
@@ -2098,26 +2099,26 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
vgroup_delete_update_users(ob, dg_index + 1);
/* Remove the group */
- BLI_freelinkN (&ob->defbase, dg);
+ BLI_freelinkN(&ob->defbase, dg);
/* Update the active deform index if necessary */
if (ob->actdef > dg_index)
ob->actdef--;
if (ob->actdef < 1 && ob->defbase.first)
- ob->actdef= 1;
+ ob->actdef = 1;
/* remove all dverts */
if (ob->defbase.first == NULL) {
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
- me->dvert= NULL;
+ me->dvert = NULL;
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
MEM_freeN(lt->dvert);
- lt->dvert= NULL;
+ lt->dvert = NULL;
}
}
}
@@ -2128,7 +2129,7 @@ static int vgroup_object_in_edit_mode(Object *ob)
if (ob->type == OB_MESH)
return (BMEdit_FromObject(ob) != NULL);
else if (ob->type == OB_LATTICE)
- return (((Lattice*)ob->data)->editlatt != NULL);
+ return (((Lattice *)ob->data)->editlatt != NULL);
return 0;
}
@@ -2147,7 +2148,7 @@ static int vgroup_object_in_wpaint_vert_select(Object *ob)
static void vgroup_delete(Object *ob)
{
- bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef-1);
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1);
if (!dg)
return;
@@ -2160,16 +2161,16 @@ static void vgroup_delete(Object *ob)
static void vgroup_delete_all(Object *ob)
{
/* Remove all DVerts */
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
- me->dvert= NULL;
+ me->dvert = NULL;
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
MEM_freeN(lt->dvert);
- lt->dvert= NULL;
+ lt->dvert = NULL;
}
}
@@ -2177,20 +2178,20 @@ static void vgroup_delete_all(Object *ob)
BLI_freelistN(&ob->defbase);
/* Fix counters/indices */
- ob->actdef= 0;
+ ob->actdef = 0;
}
/* only in editmode */
static void vgroup_assign_verts(Object *ob, const float weight)
{
MDeformVert *dv;
- const int def_nr= ob->actdef-1;
+ const int def_nr = ob->actdef - 1;
if (!BLI_findlink(&ob->defbase, def_nr))
return;
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
@@ -2204,10 +2205,10 @@ static void vgroup_assign_verts(Object *ob, const float weight)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
MDeformWeight *dw;
- dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
- dw= defvert_verify_index(dv, def_nr);
+ dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
+ dw = defvert_verify_index(dv, def_nr);
if (dw) {
- dw->weight= weight;
+ dw->weight = weight;
}
}
}
@@ -2224,35 +2225,35 @@ static void vgroup_assign_verts(Object *ob, const float weight)
mv = me->mvert;
dv = me->dvert;
- for (i=0; i<me->totvert; i++, mv++, dv++) {
+ for (i = 0; i < me->totvert; i++, mv++, dv++) {
if (mv->flag & SELECT) {
MDeformWeight *dw;
- dw= defvert_verify_index(dv, def_nr);
+ dw = defvert_verify_index(dv, def_nr);
if (dw) {
- dw->weight= weight;
+ dw->weight = weight;
}
}
}
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
BPoint *bp;
int a, tot;
- if (lt->dvert==NULL)
+ if (lt->dvert == NULL)
ED_vgroup_data_create(&lt->id);
- dv= lt->dvert;
+ dv = lt->dvert;
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) {
if (bp->f1 & SELECT) {
MDeformWeight *dw;
- dw= defvert_verify_index(dv, def_nr);
+ dw = defvert_verify_index(dv, def_nr);
if (dw) {
- dw->weight= weight;
+ dw->weight = weight;
}
}
}
@@ -2268,7 +2269,7 @@ static void vgroup_remove_verts(Object *ob, int allverts)
* active group index
*/
bDeformGroup *dg;
- for (dg= ob->defbase.first; dg; dg= dg->next) {
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
vgroup_active_remove_verts(ob, allverts, dg);
}
}
@@ -2277,15 +2278,15 @@ static void vgroup_remove_verts(Object *ob, int allverts)
static int vertex_group_poll(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
}
-static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
+static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext * C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
if (!(ob && !ob->id.lib && data && !data->lib))
return 0;
@@ -2296,24 +2297,24 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
/* editmode _or_ weight paint vertex sel */
static int vertex_group_poll_edit_or_wpaint_vert_select(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
if (!(ob && !ob->id.lib && data && !data->lib))
return 0;
- return ( vgroup_object_in_edit_mode(ob) ||
- vgroup_object_in_wpaint_vert_select(ob) );
+ return (vgroup_object_in_edit_mode(ob) ||
+ vgroup_object_in_wpaint_vert_select(ob));
}
static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
ED_vgroup_add(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -2329,12 +2330,12 @@ void OBJECT_OT_vertex_group_add(wmOperatorType *ot)
ot->exec = vertex_group_add_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_remove_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (RNA_boolean_get(op->ptr, "all"))
vgroup_delete_all(ob);
@@ -2342,8 +2343,8 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
vgroup_delete(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -2362,7 +2363,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
/* redo operator will fail in this case because vertex groups aren't stored
* in local edit mode stack and toggling "all" property will lead to
* all groups deleted without way to restore them (see [#29527], sergey) */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups");
@@ -2370,15 +2371,15 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
static int vertex_group_assign_exec(bContext *C, wmOperator *op)
{
- ToolSettings *ts= CTX_data_tool_settings(C);
- Object *ob= ED_object_context(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ Object *ob = ED_object_context(C);
if (RNA_boolean_get(op->ptr, "new"))
ED_vgroup_add(ob);
vgroup_assign_verts(ob, ts->vgroup_weight);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2397,7 +2398,7 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
/* redo operator will fail in this case because vertex group assignment
* isn't stored in local edit mode stack and toggling "new" property will
* lead to creating plenty of new vertex groups (see [#29527], sergey) */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "new", 0, "New", "Assign vertex to new vertex group");
@@ -2405,12 +2406,12 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (RNA_boolean_get(op->ptr, "all"))
vgroup_remove_verts(ob, 0);
else {
- bDeformGroup *dg= BLI_findlink(&ob->defbase, ob->actdef - 1);
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1);
if (dg == NULL) {
return OPERATOR_CANCELLED;
@@ -2420,7 +2421,7 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2439,7 +2440,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
/* redo operator will fail in this case because vertex groups assignment
* isn't stored in local edit mode stack and toggling "all" property will lead to
* removing vertices from all groups (see [#29527], sergey) */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups");
@@ -2447,13 +2448,13 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (!ob || ob->id.lib)
return OPERATOR_CANCELLED;
vgroup_select_verts(ob, 1);
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -2469,15 +2470,15 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot)
ot->exec = vertex_group_select_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
vgroup_select_verts(ob, 0);
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -2493,18 +2494,18 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
ot->exec = vertex_group_deselect_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/*Adds a copy of selected vertex group from source object to source object*/
static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
vgroup_duplicate(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2520,21 +2521,21 @@ void OBJECT_OT_vertex_group_copy(wmOperatorType *ot)
ot->exec = vertex_group_copy_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_levels_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
- float offset= RNA_float_get(op->ptr,"offset");
- float gain= RNA_float_get(op->ptr,"gain");
+ float offset = RNA_float_get(op->ptr, "offset");
+ float gain = RNA_float_get(op->ptr, "gain");
vgroup_levels(ob, offset, gain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2550,7 +2551,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
ot->exec = vertex_group_levels_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "offset", 0.f, -1.0, 1.0, "Offset", "Value to add to weights", -1.0f, 1.f);
RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by", 0.0f, 10.f);
@@ -2558,13 +2559,13 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
vgroup_normalize(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2580,19 +2581,19 @@ void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot)
ot->exec = vertex_group_normalize_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
- int lock_active= RNA_boolean_get(op->ptr,"lock_active");
+ Object *ob = ED_object_context(C);
+ int lock_active = RNA_boolean_get(op->ptr, "lock_active");
vgroup_normalize_all(ob, lock_active);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2608,7 +2609,7 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
ot->exec = vertex_group_normalize_all_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "lock_active", TRUE, "Lock Active",
"Keep the values of the active group while normalizing others");
@@ -2616,16 +2617,16 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
static int vertex_group_fix_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
- Scene *scene= CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
- float distToBe= RNA_float_get(op->ptr, "dist");
- float strength= RNA_float_get(op->ptr, "strength");
- float cp= RNA_float_get(op->ptr, "accuracy");
- ModifierData *md= ob->modifiers.first;
+ float distToBe = RNA_float_get(op->ptr, "dist");
+ float strength = RNA_float_get(op->ptr, "strength");
+ float cp = RNA_float_get(op->ptr, "accuracy");
+ ModifierData *md = ob->modifiers.first;
while (md) {
- if (md->type == eModifierType_Mirror && (md->mode&eModifierMode_Realtime)) {
+ if (md->type == eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) {
break;
}
md = md->next;
@@ -2638,8 +2639,8 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
vgroup_fix(scene, ob, distToBe, strength, cp);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2650,14 +2651,14 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
ot->name = "Fix Vertex Group Deform";
ot->idname = "OBJECT_OT_vertex_group_fix";
ot->description = "Modify the position of selected vertices by changing only their respective "
- "groups' weights (this tool may be slow for many vertices)";
+ "groups' weights (this tool may be slow for many vertices)";
/* api callbacks */
ot->poll = vertex_group_poll;
ot->exec = vertex_group_fix_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to", -10.0f, 10.0f);
RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength",
"The distance moved can be changed by this multiplier", -2.0f, 2.0f);
@@ -2668,7 +2669,7 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
static int vertex_group_lock_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
int action = RNA_enum_get(op->ptr, "action");
@@ -2688,21 +2689,21 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
ot->exec = vertex_group_lock_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
static int vertex_group_invert_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
- int auto_assign= RNA_boolean_get(op->ptr,"auto_assign");
- int auto_remove= RNA_boolean_get(op->ptr,"auto_remove");
+ Object *ob = ED_object_context(C);
+ int auto_assign = RNA_boolean_get(op->ptr, "auto_assign");
+ int auto_remove = RNA_boolean_get(op->ptr, "auto_remove");
vgroup_invert(ob, auto_assign, auto_remove);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2718,7 +2719,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot)
ot->exec = vertex_group_invert_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "auto_assign", TRUE, "Add Weights",
"Add verts from groups that have zero weight before inverting");
@@ -2735,8 +2736,8 @@ static int vertex_group_blend_exec(bContext *C, wmOperator *op)
vgroup_blend(ob, fac);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2745,7 +2746,7 @@ static int vertex_group_blend_exec(bContext *C, wmOperator *op)
static int vertex_group_blend_poll(bContext *C)
{
Object *ob = ED_object_context(C);
- ID *data = (ob) ? ob->data: NULL;
+ ID *data = (ob) ? ob->data : NULL;
if (!(ob && !ob->id.lib && data && !data->lib))
return FALSE;
@@ -2782,7 +2783,7 @@ void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
ot->exec = vertex_group_blend_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
prop = RNA_def_property(ot->srna, "factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Factor", "");
@@ -2793,18 +2794,18 @@ void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
static int vertex_group_clean_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
- float limit= RNA_float_get(op->ptr,"limit");
- int all_groups= RNA_boolean_get(op->ptr,"all_groups");
- int keep_single= RNA_boolean_get(op->ptr,"keep_single");
+ float limit = RNA_float_get(op->ptr, "limit");
+ int all_groups = RNA_boolean_get(op->ptr, "all_groups");
+ int keep_single = RNA_boolean_get(op->ptr, "keep_single");
- if (all_groups) vgroup_clean_all(ob, limit, keep_single);
- else vgroup_clean(ob, limit, keep_single);
+ if (all_groups) vgroup_clean_all(ob, limit, keep_single);
+ else vgroup_clean(ob, limit, keep_single);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2821,7 +2822,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
ot->exec = vertex_group_clean_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.001f, 0.99f);
RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Clean all vertex groups");
@@ -2832,16 +2833,16 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
static int vertex_group_mirror_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
ED_vgroup_mirror(ob,
- RNA_boolean_get(op->ptr,"mirror_weights"),
- RNA_boolean_get(op->ptr,"flip_group_names"),
- RNA_boolean_get(op->ptr,"all_groups"));
+ RNA_boolean_get(op->ptr, "mirror_weights"),
+ RNA_boolean_get(op->ptr, "flip_group_names"),
+ RNA_boolean_get(op->ptr, "all_groups"));
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2852,14 +2853,14 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
ot->name = "Mirror Vertex Group";
ot->idname = "OBJECT_OT_vertex_group_mirror";
ot->description = "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, "
- "flipping when both sides are selected otherwise copy from unselected";
+ "flipping when both sides are selected otherwise copy from unselected";
/* api callbacks */
ot->poll = vertex_group_poll;
ot->exec = vertex_group_mirror_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "mirror_weights", TRUE, "Mirror Weights", "Mirror weights");
@@ -2870,21 +2871,21 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
Base *base;
- int retval= OPERATOR_CANCELLED;
+ int retval = OPERATOR_CANCELLED;
- for (base=scene->base.first; base; base= base->next) {
- if (base->object->type==ob->type) {
- if (base->object!=ob && base->object->data==ob->data) {
+ for (base = scene->base.first; base; base = base->next) {
+ if (base->object->type == ob->type) {
+ if (base->object != ob && base->object->data == ob->data) {
BLI_freelistN(&base->object->defbase);
BLI_duplicatelist(&base->object->defbase, &ob->defbase);
- base->object->actdef= ob->actdef;
+ base->object->actdef = ob->actdef;
DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, base->object);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, base->object);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, base->object->data);
retval = OPERATOR_FINISHED;
}
@@ -2906,21 +2907,20 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
ot->exec = vertex_group_copy_to_linked_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/*Copy vertex groups from source to target*/ /*warning! overwrites list*/
static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
{
- Object *obact= ED_object_context(C);
- int change= 0;
- int fail= 0;
+ Object *obact = ED_object_context(C);
+ int change = 0;
+ int fail = 0;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (obact != ob) {
if (ED_vgroup_copy_array(ob, obact)) change++;
- else fail++;
+ else fail++;
}
}
CTX_DATA_END;
@@ -2947,7 +2947,7 @@ void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
ot->exec= vertex_group_copy_to_selected_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_copy_to_selected_single_exec(bContext *C, wmOperator *op)
@@ -3002,44 +3002,45 @@ void OBJECT_OT_vertex_group_copy_to_selected_single(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static EnumPropertyItem vgroup_items[]= {
- {0, NULL, 0, NULL, NULL}};
+static EnumPropertyItem vgroup_items[] = {
+ {0, NULL, 0, NULL, NULL}
+};
static int set_active_group_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
- int nr= RNA_enum_get(op->ptr, "group");
+ Object *ob = ED_object_context(C);
+ int nr = RNA_enum_get(op->ptr, "group");
- BLI_assert(nr+1 >= 0);
- ob->actdef= nr+1;
+ BLI_assert(nr + 1 >= 0);
+ ob->actdef = nr + 1;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
return OPERATOR_FINISHED;
}
static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
bDeformGroup *def;
- int a, totitem= 0;
+ int a, totitem = 0;
if (!ob)
return vgroup_items;
- for (a=0, def=ob->defbase.first; def; def=def->next, a++) {
- tmp.value= a;
- tmp.icon= ICON_GROUP_VERTEX;
- tmp.identifier= def->name;
- tmp.name= def->name;
+ for (a = 0, def = ob->defbase.first; def; def = def->next, a++) {
+ tmp.value = a;
+ tmp.icon = ICON_GROUP_VERTEX;
+ tmp.identifier = def->name;
+ tmp.name = def->name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -3059,10 +3060,10 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot)
ot->invoke = WM_menu_invoke;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active");
+ prop = RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active");
RNA_def_enum_funcs(prop, vgroup_itemf);
ot->prop = prop;
}
@@ -3073,11 +3074,11 @@ static char *vgroup_init_remap(Object *ob)
{
bDeformGroup *def;
int defbase_tot = BLI_countlist(&ob->defbase);
- char *name_array= MEM_mallocN(MAX_VGROUP_NAME * sizeof(char) * defbase_tot, "sort vgroups");
+ char *name_array = MEM_mallocN(MAX_VGROUP_NAME * sizeof(char) * defbase_tot, "sort vgroups");
char *name;
- name= name_array;
- for (def = ob->defbase.first; def; def=def->next) {
+ name = name_array;
+ for (def = ob->defbase.first; def; def = def->next) {
BLI_strncpy(name, def->name, MAX_VGROUP_NAME);
name += MAX_VGROUP_NAME;
}
@@ -3087,33 +3088,33 @@ static char *vgroup_init_remap(Object *ob)
static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
{
- MDeformVert *dvert= NULL;
+ MDeformVert *dvert = NULL;
bDeformGroup *def;
int defbase_tot = BLI_countlist(&ob->defbase);
/* needs a dummy index at the start*/
- int *sort_map_update= MEM_mallocN(sizeof(int) * (defbase_tot + 1), "sort vgroups");
- int *sort_map= sort_map_update + 1;
+ int *sort_map_update = MEM_mallocN(sizeof(int) * (defbase_tot + 1), "sort vgroups");
+ int *sort_map = sort_map_update + 1;
char *name;
int i;
- name= name_array;
- for (def= ob->defbase.first, i=0; def; def=def->next, i++) {
- sort_map[i]= BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
+ name = name_array;
+ for (def = ob->defbase.first, i = 0; def; def = def->next, i++) {
+ sort_map[i] = BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
name += MAX_VGROUP_NAME;
BLI_assert(sort_map[i] != -1);
}
if (ob->mode == OB_MODE_EDIT) {
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
BMIter iter;
BMVert *eve;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dvert && dvert->totweight) {
defvert_remap(dvert, sort_map, defbase_tot);
}
@@ -3126,7 +3127,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
}
}
else {
- int dvert_tot=0;
+ int dvert_tot = 0;
ED_vgroup_give_array(ob->data, &dvert, &dvert_tot);
@@ -3139,14 +3140,14 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
}
/* update users */
- for (i=0; i<defbase_tot; i++)
+ for (i = 0; i < defbase_tot; i++)
sort_map[i]++;
- sort_map_update[0]= 0;
+ sort_map_update[0] = 0;
vgroup_remap_update_users(ob, sort_map_update);
BLI_assert(sort_map_update[ob->actdef] >= 0);
- ob->actdef= sort_map_update[ob->actdef];
+ ob->actdef = sort_map_update[ob->actdef];
MEM_freeN(sort_map_update);
@@ -3155,15 +3156,15 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
static int vgroup_sort(void *def_a_ptr, void *def_b_ptr)
{
- bDeformGroup *def_a= (bDeformGroup *)def_a_ptr;
- bDeformGroup *def_b= (bDeformGroup *)def_b_ptr;
+ bDeformGroup *def_a = (bDeformGroup *)def_a_ptr;
+ bDeformGroup *def_b = (bDeformGroup *)def_b_ptr;
return BLI_natstrcmp(def_a->name, def_b->name);
}
static int vertex_group_sort_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
char *name_array;
int ret;
@@ -3178,7 +3179,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
if (ret != OPERATOR_CANCELLED) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
}
if (name_array) MEM_freeN(name_array);
@@ -3197,15 +3198,15 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
ot->exec = vertex_group_sort_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vgroup_move_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
bDeformGroup *def;
char *name_array;
- int dir= RNA_enum_get(op->ptr, "direction"), ret;
+ int dir = RNA_enum_get(op->ptr, "direction"), ret;
def = BLI_findlink(&ob->defbase, ob->actdef - 1);
if (!def) {
@@ -3233,7 +3234,7 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
if (ret != OPERATOR_CANCELLED) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
}
return ret;
@@ -3256,7 +3257,7 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot)
ot->exec = vgroup_move_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", "Direction to move, UP or DOWN");
}
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 417cddb74fe..c82e0459218 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -291,8 +291,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
if (!dynamicPaint_createUVSurface(surface)) return 0;
/* Loop through selected frames */
- for (frame=surface->start_frame; frame<=surface->end_frame; frame++)
- {
+ for (frame=surface->start_frame; frame<=surface->end_frame; frame++) {
float progress = (frame - surface->start_frame) / (float)frames * 100;
surface->current_frame = frame;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 5f22165176b..b541529e4c0 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -45,7 +45,9 @@
#include "DNA_space_types.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
+#include "BLI_lasso.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "BLI_dynstr.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
@@ -213,7 +215,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
/* in the case of only one editable thing, set pset->edittype accordingly */
if (pidlist.first && pidlist.first == pidlist.last) {
pid = pidlist.first;
- switch(pid->type) {
+ switch (pid->type) {
case PTCACHE_TYPE_PARTICLES:
pset->edittype = PE_TYPE_PARTICLES;
break;
@@ -401,7 +403,7 @@ static int key_test_depth(PEData *data, const float co[3])
View3D *v3d= data->vc.v3d;
double ux, uy, uz;
float depth;
- short wco[3], x,y;
+ short wco[3], x, y;
/* nothing to do */
if ((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
@@ -412,7 +414,7 @@ static int key_test_depth(PEData *data, const float co[3])
if (wco[0] == IS_CLIPPED)
return 0;
- gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection,
+ gluProject(co[0], co[1], co[2], data->mats.modelview, data->mats.projection,
(GLint *)data->mats.viewport, &ux, &uy, &uz);
x=wco[0];
@@ -471,14 +473,16 @@ static int key_inside_rect(PEData *data, const float co[3])
{
int sco[2];
- project_int(data->vc.ar, co,sco);
+ project_int(data->vc.ar, co, sco);
if (sco[0] == IS_CLIPPED)
return 0;
-
+
if (sco[0] > data->rect->xmin && sco[0] < data->rect->xmax &&
- sco[1] > data->rect->ymin && sco[1] < data->rect->ymax)
+ sco[1] > data->rect->ymin && sco[1] < data->rect->ymax)
+ {
return key_test_depth(data, co);
+ }
return 0;
}
@@ -618,7 +622,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
}
func(data, mat, imat, p, point->totkey-1, key);
@@ -632,7 +636,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
}
func(data, mat, imat, p, k, key);
@@ -898,7 +902,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
return;
psys = edit->psys;
- psmd = psys_get_modifier(ob,psys);
+ psmd = psys_get_modifier(ob, psys);
if (!psmd->dm)
return;
@@ -916,26 +920,26 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
dist_1st *= 0.75f * pset->emitterdist;
}
else {
- index= BLI_kdtree_find_nearest(edit->emitter_field,key->co,NULL,NULL);
+ index= BLI_kdtree_find_nearest(edit->emitter_field, key->co, NULL, NULL);
vec=edit->emitter_cosnos +index*6;
nor=vec+3;
sub_v3_v3v3(dvec, key->co, vec);
- dot=dot_v3v3(dvec,nor);
- copy_v3_v3(dvec,nor);
+ dot=dot_v3v3(dvec, nor);
+ copy_v3_v3(dvec, nor);
if (dot>0.0f) {
if (dot<dist_1st) {
normalize_v3(dvec);
- mul_v3_fl(dvec,dist_1st-dot);
+ mul_v3_fl(dvec, dist_1st-dot);
add_v3_v3(key->co, dvec);
}
}
else {
normalize_v3(dvec);
- mul_v3_fl(dvec,dist_1st-dot);
+ mul_v3_fl(dvec, dist_1st-dot);
add_v3_v3(key->co, dvec);
}
if (k==1)
@@ -943,7 +947,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
}
}
- invert_m4_m4(hairimat,hairmat);
+ invert_m4_m4(hairimat, hairmat);
LOOP_KEYS {
mul_m4_v3(hairimat, key->co);
@@ -1049,7 +1053,7 @@ static void recalc_lengths(PTCacheEdit *edit)
/* calculate a tree for finding nearest emitter's vertice */
static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
{
- DerivedMesh *dm=psys_get_modifier(ob,psys)->dm;
+ DerivedMesh *dm=psys_get_modifier(ob, psys)->dm;
PTCacheEdit *edit= psys->edit;
float *vec, *nor;
int i, totface /*, totvert*/;
@@ -1065,7 +1069,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
totface=dm->getNumTessFaces(dm);
/*totvert=dm->getNumVerts(dm);*/ /*UNSUED*/
- edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float),"emitter cosnos");
+ edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float), "emitter cosnos");
edit->emitter_field= BLI_kdtree_new(totface);
@@ -1073,30 +1077,30 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
nor=vec+3;
for (i=0; i<totface; i++, vec+=6, nor+=6) {
- MFace *mface=dm->getTessFaceData(dm,i,CD_MFACE);
+ MFace *mface=dm->getTessFaceData(dm, i, CD_MFACE);
MVert *mvert;
- mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
- copy_v3_v3(vec,mvert->co);
- VECCOPY(nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v1, CD_MVERT);
+ copy_v3_v3(vec, mvert->co);
+ VECCOPY(nor, mvert->no);
- mvert=dm->getVertData(dm,mface->v2,CD_MVERT);
- add_v3_v3v3(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v2, CD_MVERT);
+ add_v3_v3v3(vec, vec, mvert->co);
+ VECADD(nor, nor, mvert->no);
- mvert=dm->getVertData(dm,mface->v3,CD_MVERT);
- add_v3_v3v3(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v3, CD_MVERT);
+ add_v3_v3v3(vec, vec, mvert->co);
+ VECADD(nor, nor, mvert->no);
if (mface->v4) {
- mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
- add_v3_v3v3(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v4, CD_MVERT);
+ add_v3_v3v3(vec, vec, mvert->co);
+ VECADD(nor, nor, mvert->no);
- mul_v3_fl(vec,0.25);
+ mul_v3_fl(vec, 0.25);
}
else
- mul_v3_fl(vec,0.3333f);
+ mul_v3_fl(vec, 0.3333f);
normalize_v3(nor);
@@ -1150,7 +1154,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat);
LOOP_KEYS {
- copy_v3_v3(key->world_co,key->co);
+ copy_v3_v3(key->world_co, key->co);
if (!(psys->flag & PSYS_GLOBAL_HAIR))
mul_m4_v3(hairmat, key->world_co);
}
@@ -1235,7 +1239,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
pe_deflect_emitter(scene, ob, edit);
PE_apply_lengths(scene, edit);
if (pe_x_mirror(ob))
- PE_apply_mirror(ob,edit->psys);
+ PE_apply_mirror(ob, edit->psys);
if (edit->psys)
update_world_cos(ob, edit);
if (pset->flag & PE_AUTO_VELOCITY)
@@ -1633,7 +1637,9 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co, vertco);
- if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
+ if (BLI_lasso_is_point_inside(mcords, moves, vertco[0], vertco[1], IS_CLIPPED) &&
+ key_test_depth(&data, co))
+ {
if (select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
@@ -1650,8 +1656,10 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
- project_int(ar, co,vertco);
- if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
+ project_int(ar, co, vertco);
+ if (BLI_lasso_is_point_inside(mcords, moves, vertco[0], vertco[1], IS_CLIPPED) &&
+ key_test_depth(&data, co))
+ {
if (select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
@@ -1900,7 +1908,7 @@ static void rekey_particle(PEData *data, int pa_index)
pa->flag |= PARS_REKEY;
- key= new_keys= MEM_callocN(data->totrekey * sizeof(HairKey),"Hair re-key keys");
+ key= new_keys= MEM_callocN(data->totrekey * sizeof(HairKey), "Hair re-key keys");
okey = pa->hair;
/* root and tip stay the same */
@@ -1912,7 +1920,7 @@ static void rekey_particle(PEData *data, int pa_index)
dval= (end - sta) / (float)(data->totrekey - 1);
/* interpolate new keys from old ones */
- for (k=1,key++; k<data->totrekey-1; k++,key++) {
+ for (k=1, key++; k<data->totrekey-1; k++, key++) {
state.time= (float)k / (float)(data->totrekey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
copy_v3_v3(key->co, state.co);
@@ -1929,7 +1937,7 @@ static void rekey_particle(PEData *data, int pa_index)
if (point->keys)
MEM_freeN(point->keys);
- ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey),"Hair re-key edit keys");
+ ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey), "Hair re-key edit keys");
for (k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
ekey->co= key->co;
@@ -2215,7 +2223,7 @@ static void subdivide_particle(PEData *data, int pa_index)
sim.ob= data->ob;
sim.psys= edit->psys;
- for (k=0, ekey=point->keys; k<pa->totkey-1; k++,ekey++) {
+ for (k=0, ekey=point->keys; k<pa->totkey-1; k++, ekey++) {
if (ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
totnewkey++;
}
@@ -2224,16 +2232,16 @@ static void subdivide_particle(PEData *data, int pa_index)
pa->flag |= PARS_REKEY;
- nkey= new_keys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(HairKey)),"Hair subdivide keys");
- nekey= new_ekeys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(PTCacheEditKey)),"Hair subdivide edit keys");
+ nkey= new_keys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(HairKey)), "Hair subdivide keys");
+ nekey= new_ekeys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(PTCacheEditKey)), "Hair subdivide edit keys");
key = pa->hair;
endtime= key[pa->totkey-1].time;
for (k=0, ekey=point->keys; k<pa->totkey-1; k++, key++, ekey++) {
- memcpy(nkey,key,sizeof(HairKey));
- memcpy(nekey,ekey,sizeof(PTCacheEditKey));
+ memcpy(nkey, key, sizeof(HairKey));
+ memcpy(nekey, ekey, sizeof(PTCacheEditKey));
nekey->co= nkey->co;
nekey->time= &nkey->time;
@@ -2258,8 +2266,8 @@ static void subdivide_particle(PEData *data, int pa_index)
}
}
/*tip still not copied*/
- memcpy(nkey,key,sizeof(HairKey));
- memcpy(nekey,ekey,sizeof(PTCacheEditKey));
+ memcpy(nkey, key, sizeof(HairKey));
+ memcpy(nekey, ekey, sizeof(PTCacheEditKey));
nekey->co= nkey->co;
nekey->time= &nkey->time;
@@ -2348,7 +2356,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
- totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
+ totn= BLI_kdtree_find_n_nearest(tree, 10, co, NULL, nearest);
for (n=0; n<totn; n++) {
/* this needs a custom threshold still */
@@ -2463,11 +2471,11 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
glTranslatef((float)x, (float)y, 0.0f);
glColor4ub(255, 255, 255, 128);
- glEnable(GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glutil_draw_lined_arc(0.0, M_PI*2.0, brush->size, 40);
glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
@@ -2658,7 +2666,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
/* assign face inddex */
newpa->num= mirrorfaces[pa->num*2];
- newpa->num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,newpa->num,newpa->fuv, NULL);
+ newpa->num_dmcache= psys_particle_dm_face_lookup(ob, psmd->dm, newpa->num, newpa->fuv, NULL);
/* update edit key pointers */
key= newpoint->keys;
@@ -2722,8 +2730,8 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
- copy_v3_v3(cvec,data->dvec);
- mul_mat3_m4_v3(imat,cvec);
+ copy_v3_v3(cvec, data->dvec);
+ mul_mat3_m4_v3(imat, cvec);
mul_v3_fl(cvec, fac);
add_v3_v3(key->co, cvec);
@@ -2832,17 +2840,17 @@ static void brush_length(PEData *data, int point_index)
PTCacheEdit *edit= data->edit;
PTCacheEditPoint *point = edit->points + point_index;
KEY_K;
- float dvec[3],pvec[3] = {0.0f, 0.0f, 0.0f};
+ float dvec[3], pvec[3] = {0.0f, 0.0f, 0.0f};
LOOP_KEYS {
if (k==0) {
- copy_v3_v3(pvec,key->co);
+ copy_v3_v3(pvec, key->co);
}
else {
- sub_v3_v3v3(dvec,key->co,pvec);
- copy_v3_v3(pvec,key->co);
- mul_v3_fl(dvec,data->growfac);
- add_v3_v3v3(key->co,(key-1)->co,dvec);
+ sub_v3_v3v3(dvec, key->co, pvec);
+ copy_v3_v3(pvec, key->co);
+ mul_v3_fl(dvec, data->growfac);
+ add_v3_v3v3(key->co, (key-1)->co, dvec);
}
}
@@ -2869,7 +2877,7 @@ static void brush_puff(PEData *data, int point_index)
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, psys->particles + point_index, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
}
else {
unit_m4(mat);
@@ -3001,8 +3009,8 @@ static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4
if (key_index) {
float dvec[3];
- sub_v3_v3v3(dvec,key->co,(key-1)->co);
- mul_mat3_m4_v3(mat,dvec);
+ sub_v3_v3v3(dvec, key->co, (key-1)->co);
+ mul_mat3_m4_v3(mat, dvec);
add_v3_v3(data->vec, dvec);
data->tot++;
}
@@ -3014,12 +3022,12 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4
if (key_index) {
copy_v3_v3(vec, data->vec);
- mul_mat3_m4_v3(imat,vec);
+ mul_mat3_m4_v3(imat, vec);
- sub_v3_v3v3(dvec,key->co,(key-1)->co);
+ sub_v3_v3v3(dvec, key->co, (key-1)->co);
- sub_v3_v3v3(dvec,vec,dvec);
- mul_v3_fl(dvec,data->smoothfac);
+ sub_v3_v3v3(dvec, vec, dvec);
+ mul_v3_fl(dvec, data->smoothfac);
add_v3_v3(key->co, dvec);
}
@@ -3055,7 +3063,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
MFace *mface= NULL;
MVert *mvert= NULL;
int i, totface, intersect=0;
- float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3];
+ float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3], p_max[3];
float cur_ipoint[3];
if (dm == NULL) {
@@ -3076,50 +3084,50 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
if (pa_minmax==0) {
- INIT_MINMAX(p_min,p_max);
- DO_MINMAX(co1,p_min,p_max);
- DO_MINMAX(co2,p_min,p_max);
+ INIT_MINMAX(p_min, p_max);
+ DO_MINMAX(co1, p_min, p_max);
+ DO_MINMAX(co2, p_min, p_max);
}
else {
- copy_v3_v3(p_min,pa_minmax);
- copy_v3_v3(p_max,pa_minmax+3);
+ copy_v3_v3(p_min, pa_minmax);
+ copy_v3_v3(p_max, pa_minmax+3);
}
totface=dm->getNumTessFaces(dm);
- mface=dm->getTessFaceDataArray(dm,CD_MFACE);
- mvert=dm->getVertDataArray(dm,CD_MVERT);
+ mface=dm->getTessFaceDataArray(dm, CD_MFACE);
+ mvert=dm->getVertDataArray(dm, CD_MVERT);
/* lets intersect the faces */
- for (i=0; i<totface; i++,mface++) {
+ for (i=0; i<totface; i++, mface++) {
if (vert_cos) {
- copy_v3_v3(v1,vert_cos+3*mface->v1);
- copy_v3_v3(v2,vert_cos+3*mface->v2);
- copy_v3_v3(v3,vert_cos+3*mface->v3);
+ copy_v3_v3(v1, vert_cos+3*mface->v1);
+ copy_v3_v3(v2, vert_cos+3*mface->v2);
+ copy_v3_v3(v3, vert_cos+3*mface->v3);
if (mface->v4)
- copy_v3_v3(v4,vert_cos+3*mface->v4);
+ copy_v3_v3(v4, vert_cos+3*mface->v4);
}
else {
- copy_v3_v3(v1,mvert[mface->v1].co);
- copy_v3_v3(v2,mvert[mface->v2].co);
- copy_v3_v3(v3,mvert[mface->v3].co);
+ copy_v3_v3(v1, mvert[mface->v1].co);
+ copy_v3_v3(v2, mvert[mface->v2].co);
+ copy_v3_v3(v3, mvert[mface->v3].co);
if (mface->v4)
- copy_v3_v3(v4,mvert[mface->v4].co);
+ copy_v3_v3(v4, mvert[mface->v4].co);
}
if (face_minmax==0) {
- INIT_MINMAX(min,max);
- DO_MINMAX(v1,min,max);
- DO_MINMAX(v2,min,max);
- DO_MINMAX(v3,min,max);
+ INIT_MINMAX(min, max);
+ DO_MINMAX(v1, min, max);
+ DO_MINMAX(v2, min, max);
+ DO_MINMAX(v3, min, max);
if (mface->v4)
DO_MINMAX(v4, min, max);
- if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (isect_aabb_aabb_v3(min, max, p_min, p_max)==0)
continue;
}
else {
copy_v3_v3(min, face_minmax+6*i);
copy_v3_v3(max, face_minmax+6*i+3);
- if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (isect_aabb_aabb_v3(min, max, p_min, p_max)==0)
continue;
}
@@ -3127,7 +3135,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)) {
if (cur_d<*min_d) {
*min_d=cur_d;
- copy_v3_v3(ipoint,cur_ipoint);
+ copy_v3_v3(ipoint, cur_ipoint);
*min_face=i;
intersect=1;
}
@@ -3136,7 +3144,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)) {
if (cur_d<*min_d) {
*min_d=cur_d;
- copy_v3_v3(ipoint,cur_ipoint);
+ copy_v3_v3(ipoint, cur_ipoint);
*min_face=i;
intersect=1;
}
@@ -3182,8 +3190,8 @@ static int brush_add(PEData *data, short number)
Object *ob= data->ob;
PTCacheEdit *edit = data->edit;
ParticleSystem *psys= edit->psys;
- ParticleData *add_pars= MEM_callocN(number*sizeof(ParticleData),"ParticleData add");
- ParticleSystemModifierData *psmd= psys_get_modifier(ob,psys);
+ ParticleData *add_pars= MEM_callocN(number*sizeof(ParticleData), "ParticleData add");
+ ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
ParticleSimulationData sim= {0};
ParticleEditSettings *pset= PE_settings(scene);
int i, k, n= 0, totpart= psys->totpart;
@@ -3194,7 +3202,7 @@ static int brush_add(PEData *data, short number)
short size= pset->brush[PE_BRUSH_ADD].size;
short size2= size*size;
DerivedMesh *dm=0;
- invert_m4_m4(imat,ob->obmat);
+ invert_m4_m4(imat, ob->obmat);
if (psys->flag & PSYS_GLOBAL_HAIR)
return 0;
@@ -3227,13 +3235,13 @@ static int brush_add(PEData *data, short number)
mco[1]= data->mval[1] + dmy;
ED_view3d_win_to_segment_clip(data->vc.ar, data->vc.v3d, mco, co1, co2);
- mul_m4_v3(imat,co1);
- mul_m4_v3(imat,co2);
+ mul_m4_v3(imat, co1);
+ mul_m4_v3(imat, co2);
min_d=2.0;
/* warning, returns the derived mesh face */
- if (particle_intersect_dm(scene, ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
- add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,add_pars[n].num,add_pars[n].fuv,NULL);
+ if (particle_intersect_dm(scene, ob, dm, 0, co1, co2, &min_d, &add_pars[n].num, add_pars[n].fuv, 0, 0, 0, 0)) {
+ add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob, psmd->dm, add_pars[n].num, add_pars[n].fuv, NULL);
n++;
}
}
@@ -3241,8 +3249,8 @@ static int brush_add(PEData *data, short number)
int newtotpart=totpart+n;
float hairmat[4][4], cur_co[3];
KDTree *tree=0;
- ParticleData *pa, *new_pars= MEM_callocN(newtotpart*sizeof(ParticleData),"ParticleData new");
- PTCacheEditPoint *point, *new_points= MEM_callocN(newtotpart*sizeof(PTCacheEditPoint),"PTCacheEditPoint array new");
+ ParticleData *pa, *new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
+ PTCacheEditPoint *point, *new_points= MEM_callocN(newtotpart*sizeof(PTCacheEditPoint), "PTCacheEditPoint array new");
PTCacheEditKey *key;
HairKey *hkey;
@@ -3267,7 +3275,7 @@ static int brush_add(PEData *data, short number)
tree=BLI_kdtree_new(psys->totpart);
for (i=0, pa=psys->particles; i<totpart; i++, pa++) {
- psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
+ psys_particle_on_dm(psmd->dm, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, cur_co, 0, 0, 0, 0, 0);
BLI_kdtree_insert(tree, i, cur_co, NULL);
}
@@ -3295,7 +3303,7 @@ static int brush_add(PEData *data, short number)
}
pa->size= 1.0f;
- initialize_particle(&sim, pa,i);
+ initialize_particle(&sim, pa, i);
reset_particle(&sim, pa, 0.0, 1.0);
point->flag |= PEP_EDIT_RECALC;
if (pe_x_mirror(ob))
@@ -3311,8 +3319,8 @@ static int brush_add(PEData *data, short number)
int w, maxw;
float maxd, totw=0.0, weight[3];
- psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,0,0);
- maxw= BLI_kdtree_find_n_nearest(tree,3,co1,NULL,ptn);
+ psys_particle_on_dm(psmd->dm, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co1, 0, 0, 0, 0, 0);
+ maxw= BLI_kdtree_find_n_nearest(tree, 3, co1, NULL, ptn);
maxd= ptn[maxw-1].dist;
@@ -3371,7 +3379,7 @@ static int brush_add(PEData *data, short number)
}
for (k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- invert_m4_m4(imat,hairmat);
+ invert_m4_m4(imat, hairmat);
mul_m4_v3(imat, hkey->co);
}
}
@@ -3487,7 +3495,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
mval[0] = bedit->lastmouse[0] + step*dx;
mval[1] = bedit->lastmouse[1] + step*dy;
- switch(pset->brushtype) {
+ switch (pset->brushtype) {
case PE_BRUSH_COMB:
{
float mval_f[2];
@@ -3627,7 +3635,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
if (pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
PE_mirror_x(scene, ob, 1);
- update_world_cos(ob,edit);
+ update_world_cos(ob, edit);
psys_free_path_cache(NULL, edit);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -3663,7 +3671,7 @@ static int brush_edit_exec(bContext *C, wmOperator *op)
if (!brush_edit_init(C, op))
return OPERATOR_CANCELLED;
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
brush_edit_apply(C, op, &itemptr);
}
RNA_END;
@@ -3704,7 +3712,7 @@ static int brush_edit_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- switch(event->type) {
+ switch (event->type) {
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE: // XXX hardcoded
@@ -3923,7 +3931,7 @@ void PE_undo_push(Scene *scene, const char *str)
}
/* copy */
- make_PTCacheUndo(edit,edit->curundo);
+ make_PTCacheUndo(edit, edit->curundo);
}
void PE_undo_step(Scene *scene, int step)
@@ -3933,7 +3941,7 @@ void PE_undo_step(Scene *scene, int step)
if (!edit) return;
if (step==0) {
- get_PTCacheUndo(edit,edit->curundo);
+ get_PTCacheUndo(edit, edit->curundo);
}
else if (step==1) {
@@ -4092,7 +4100,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
totpoint = psys ? psys->totpart : (int)((PTCacheMem*)cache->mem_cache.first)->totpoint;
edit= MEM_callocN(sizeof(PTCacheEdit), "PE_create_particle_edit");
- edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint),"PTCacheEditPoints");
+ edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint), "PTCacheEditPoints");
edit->totpoint = totpoint;
if (psys && !cache) {
@@ -4107,7 +4115,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
pa = psys->particles;
LOOP_POINTS {
point->totkey = pa->totkey;
- point->keys= MEM_callocN(point->totkey*sizeof(PTCacheEditKey),"ParticleEditKeys");
+ point->keys= MEM_callocN(point->totkey*sizeof(PTCacheEditKey), "ParticleEditKeys");
point->flag |= PEP_EDIT_RECALC;
hkey = pa->hair;
@@ -4143,7 +4151,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
continue;
if (!point->totkey) {
- key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey),"ParticleEditKeys");
+ key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey), "ParticleEditKeys");
point->flag |= PEP_EDIT_RECALC;
}
else
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 3d50ec26a40..13e407040c3 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -532,7 +532,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{
- ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
+ ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
ParticleEditSettings *pset= PE_settings(scene);
ParticleData *pa;
PTCacheEdit *edit;
@@ -551,7 +551,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
edit = psys->edit;
point= edit ? edit->points : NULL;
- for (i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
+ for (i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
if (point) {
ekey = point->keys;
point++;
@@ -559,8 +559,8 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
- mul_m4_v3(hairmat,key->co);
+ for (k=0, key=pa->hair; k<pa->totkey; k++, key++) {
+ mul_m4_v3(hairmat, key->co);
if (ekey) {
ekey->flag &= ~PEK_USE_WCO;
@@ -622,7 +622,7 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{
- ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
+ ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
ParticleData *pa;
PTCacheEdit *edit;
PTCacheEditPoint *point;
@@ -661,7 +661,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
- for (i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
+ for (i=0, pa= psys->particles; i<psys->totpart; i++, pa++) {
key = pa->hair;
nearest.index = -1;
@@ -675,23 +675,23 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
continue;
}
- mface = CDDM_get_tessface(dm,nearest.index);
+ mface = CDDM_get_tessface(dm, nearest.index);
- copy_v3_v3(v[0], CDDM_get_vert(dm,mface->v1)->co);
- copy_v3_v3(v[1], CDDM_get_vert(dm,mface->v2)->co);
- copy_v3_v3(v[2], CDDM_get_vert(dm,mface->v3)->co);
+ copy_v3_v3(v[0], CDDM_get_vert(dm, mface->v1)->co);
+ copy_v3_v3(v[1], CDDM_get_vert(dm, mface->v2)->co);
+ copy_v3_v3(v[2], CDDM_get_vert(dm, mface->v3)->co);
if (mface->v4) {
- copy_v3_v3(v[3], CDDM_get_vert(dm,mface->v4)->co);
- interp_weights_poly_v3( pa->fuv,v, 4, nearest.co);
+ copy_v3_v3(v[3], CDDM_get_vert(dm, mface->v4)->co);
+ interp_weights_poly_v3(pa->fuv, v, 4, nearest.co);
}
else
- interp_weights_poly_v3( pa->fuv,v, 3, nearest.co);
+ interp_weights_poly_v3(pa->fuv, v, 3, nearest.co);
pa->num = nearest.index;
- pa->num_dmcache = psys_particle_dm_face_lookup(ob,psmd->dm,pa->num,pa->fuv,NULL);
+ pa->num_dmcache = psys_particle_dm_face_lookup(ob, psmd->dm, pa->num, pa->fuv, NULL);
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- invert_m4_m4(imat,hairmat);
+ invert_m4_m4(imat, hairmat);
sub_v3_v3v3(vec, nearest.co, key->co);
@@ -700,9 +700,9 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
point++;
}
- for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
+ for (k=0, key=pa->hair; k<pa->totkey; k++, key++) {
add_v3_v3(key->co, vec);
- mul_m4_v3(imat,key->co);
+ mul_m4_v3(imat, key->co);
if (ekey) {
ekey->flag |= PEK_USE_WCO;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 20fa4c5753f..fa72085be7d 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -150,8 +150,8 @@ static int fluid_is_animated_mesh(FluidsimSettings *fss)
/* helper function */
void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname)
{
- //BLI_snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
- BLI_snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
+ //BLI_snprintf(dst, FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
+ BLI_snprintf(dst, FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
}
#endif
@@ -199,30 +199,30 @@ typedef struct FluidObject {
#if 0
static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char *str, int entries)
{
- int i,j;
+ int i, j;
int channelSize = paramsize;
if (entries==3) {
- elbeemSimplifyChannelVec3( channel, &channelSize);
+ elbeemSimplifyChannelVec3(channel, &channelSize);
}
else if (entries==1) {
- elbeemSimplifyChannelFloat( channel, &channelSize);
+ elbeemSimplifyChannelFloat(channel, &channelSize);
}
else {
// invalid, cant happen?
}
fprintf(file, " CHANNEL %s =\n", str);
- for (i=0; i<channelSize;i++) {
- fprintf(file," ");
- for (j=0;j<=entries;j++) { // also print time value
- fprintf(file," %f ", channel[i*(entries+1)+j] );
- if (j==entries-1) { fprintf(file," "); }
+ for (i=0; i < channelSize; i++) {
+ fprintf(file, " ");
+ for (j=0;j <= entries;j++) { // also print time value
+ fprintf(file, " %f ", channel[i*(entries + 1) + j]);
+ if (j==entries-1) { fprintf(file, " "); }
}
- fprintf(file,"\n");
+ fprintf(file, "\n");
}
- fprintf(file, " ;\n" );
+ fprintf(file, " ;\n");
}
#endif
@@ -243,7 +243,7 @@ static void init_time(FluidsimSettings *domainSettings, FluidAnimChannels *chann
{
int i;
- channels->timeAtFrame = MEM_callocN( (channels->length+1)*sizeof(float), "timeAtFrame channel");
+ channels->timeAtFrame = MEM_callocN((channels->length+1)*sizeof(float), "timeAtFrame channel");
channels->timeAtFrame[0] = channels->timeAtFrame[1] = domainSettings->animStart; // start at index 1
@@ -361,9 +361,9 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
init_time(domainSettings, channels);
/* allocate domain animation channels */
- channels->DomainGravity = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "channel DomainGravity");
- channels->DomainViscosity = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainViscosity");
- channels->DomainTime = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainTime");
+ channels->DomainGravity = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "channel DomainGravity");
+ channels->DomainViscosity = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainViscosity");
+ channels->DomainTime = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainTime");
/* allocate fluid objects */
for (base=scene->base.first; base; base= base->next) {
@@ -379,17 +379,17 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
continue;
}
- fobj->Translation = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Translation");
- fobj->Rotation = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Rotation");
- fobj->Scale = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Scale");
- fobj->Active = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject Active");
- fobj->InitialVelocity = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject InitialVelocity");
+ fobj->Translation = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Translation");
+ fobj->Rotation = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Rotation");
+ fobj->Scale = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Scale");
+ fobj->Active = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject Active");
+ fobj->InitialVelocity = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject InitialVelocity");
if (fluidmd->fss->type == OB_FLUIDSIM_CONTROL) {
- fobj->AttractforceStrength = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceStrength");
- fobj->AttractforceRadius = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceRadius");
- fobj->VelocityforceStrength = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceStrength");
- fobj->VelocityforceRadius = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceRadius");
+ fobj->AttractforceStrength = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceStrength");
+ fobj->AttractforceRadius = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceRadius");
+ fobj->VelocityforceStrength = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceStrength");
+ fobj->VelocityforceRadius = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceRadius");
}
if (fluid_is_animated_mesh(fluidmd->fss)) {
@@ -397,7 +397,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
int *tris=NULL, modifierIndex = modifiers_indexInObject(ob, (ModifierData *)fluidmd);
initElbeemMesh(scene, ob, &fobj->numVerts, &verts, &fobj->numTris, &tris, 0, modifierIndex);
- fobj->VertexCache = MEM_callocN( length *((fobj->numVerts*CHANNEL_VEC)+1) * sizeof(float), "fluidobject VertexCache");
+ fobj->VertexCache = MEM_callocN(length *((fobj->numVerts*CHANNEL_VEC)+1) * sizeof(float), "fluidobject VertexCache");
MEM_freeN(verts);
MEM_freeN(tris);
@@ -507,7 +507,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
if (ELEM(fluidmd->fss->type, OB_FLUIDSIM_DOMAIN, OB_FLUIDSIM_PARTICLE))
continue;
- elbeemResetMesh( &fsmesh );
+ elbeemResetMesh(&fsmesh);
fsmesh.type = fluidmd->fss->type;
fsmesh.name = ob->id.name;
@@ -594,8 +594,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
int channelObjCount = 0;
int fluidInputCount = 0;
- for (base=scene->base.first; base; base= base->next)
- {
+ for (base=scene->base.first; base; base= base->next) {
Object *ob = base->object;
FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
@@ -680,7 +679,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if (fileCfg) {
dirExist = 1; fclose(fileCfg);
// remove cfg dummy from directory test
- BLI_delete(targetFile, 0,0);
+ BLI_delete(targetFile, 0, 0);
}
if (targetDir[0] == '\0' || (!dirExist)) {
@@ -692,7 +691,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
BLI_splitdirstring(blendDir, blendFile);
BLI_replace_extension(blendFile, FILE_MAX, ""); /* strip .blend */
- BLI_snprintf(newSurfdataPath, FILE_MAX ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
+ BLI_snprintf(newSurfdataPath, FILE_MAX, "//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
BLI_snprintf(debugStrBuffer, 256, "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
elbeemDebugOut(debugStrBuffer);
@@ -704,7 +703,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if (outStringsChanged) {
char dispmsg[FILE_MAX+256];
int selection=0;
- BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg));
+ BLI_strncpy(dispmsg, "Output settings set to: '", sizeof(dispmsg));
strcat(dispmsg, newSurfdataPath);
strcat(dispmsg, "'%t|Continue with changed settings%x1|Discard and abort%x0");
@@ -793,7 +792,7 @@ int runSimulationCallback(void *data, int status, int frame)
if (status == FLUIDSIM_CBSTATUS_NEWFRAME) {
fluidbake_updatejob(fb, frame / (float)settings->noOfFrames);
- //printf("elbeem blender cb s%d, f%d, domainid:%d noOfFrames: %d\n", status,frame, settings->domainId, settings->noOfFrames ); // DEBUG
+ //printf("elbeem blender cb s%d, f%d, domainid:%d noOfFrames: %d\n", status, frame, settings->domainId, settings->noOfFrames ); // DEBUG
}
if (fluidbake_breakjob(fb)) {
@@ -899,7 +898,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
if (getenv(strEnvName)) {
int dlevel = atoi(getenv(strEnvName));
elbeemSetDebugLevel(dlevel);
- BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::msg: Debug messages activated due to envvar '%s'\n", strEnvName);
elbeemDebugOut(debugStrBuffer);
}
@@ -936,7 +935,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* rough check of settings... */
if (domainSettings->previewresxyz > domainSettings->resolutionxyz) {
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz, domainSettings->resolutionxyz);
elbeemDebugOut(debugStrBuffer);
domainSettings->previewresxyz = domainSettings->resolutionxyz;
}
@@ -959,7 +958,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
else {
gridlevels = domainSettings->maxRefine;
}
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name, gridlevels);
elbeemDebugOut(debugStrBuffer);
@@ -979,7 +978,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* ******** init domain object's matrix ******** */
copy_m4_m4(domainMat, fsDomain->obmat);
if (!invert_m4_m4(invDomMat, domainMat)) {
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::error - Invalid obj matrix?\n");
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - Invalid obj matrix?\n");
elbeemDebugOut(debugStrBuffer);
BKE_report(reports, RPT_ERROR, "Invalid object matrix");
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index f9737b02a01..a46e3c69456 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -348,7 +348,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->is_sequencer = is_sequencer;
if (is_sequencer) {
- oglrender->sseq = CTX_wm_space_seq(C);;
+ oglrender->sseq = CTX_wm_space_seq(C);
}
@@ -364,7 +364,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
/* MUST be cleared on exit */
oglrender->scene->customdata_mask_modal = (ED_view3d_datamask(oglrender->scene, oglrender->v3d) |
- ED_view3d_object_datamask(oglrender->scene) );
+ ED_view3d_object_datamask(oglrender->scene));
/* apply immediately in case we're rendering from a script,
* running notifiers again will overwrite */
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 6722ac5e686..b648dac6343 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -178,7 +178,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Nurb *nu;
- ListBase *nurbs = curve_editnurbs((Curve *)ob->data);
+ ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
if (nurbs) {
for (nu = nurbs->first; nu; nu = nu->next)
@@ -233,7 +233,7 @@ static int material_slot_de_select(bContext *C, int select)
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- ListBase *nurbs = curve_editnurbs((Curve *)ob->data);
+ ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -329,7 +329,7 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
if (!ob || !(matar = give_matarar(ob)))
return OPERATOR_CANCELLED;
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter && give_matarar(ob_iter)) {
if (ob->data != ob_iter->data)
assign_matarar(ob_iter, matar, ob->totcol);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index bed17048ea1..772c114e6d6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -80,26 +80,26 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
rect.ymax = scirct->ymax - ar->winrct.ymin;
/* set transp line */
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* right */
- glColor4ub(0,0,0, 30);
+ glColor4ub(0, 0, 0, 30);
sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
/* bottom */
- glColor4ub(0,0,0, 30);
+ glColor4ub(0, 0, 0, 30);
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
/* top */
- glColor4ub(255,255,255, 30);
+ glColor4ub(255, 255, 255, 30);
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
/* left */
- glColor4ub(255,255,255, 30);
+ glColor4ub(255, 255, 255, 30);
sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
- glDisable( GL_BLEND );
+ glDisable(GL_BLEND);
}
void ED_region_pixelspace(ARegion *ar)
@@ -115,7 +115,7 @@ void ED_region_pixelspace(ARegion *ar)
void ED_region_do_listen(ARegion *ar, wmNotifier *note)
{
/* generic notes first */
- switch(note->category) {
+ switch (note->category) {
case NC_WM:
if (note->data==ND_FILEREAD)
ED_region_tag_redraw(ar);
@@ -213,12 +213,12 @@ static void region_draw_azone_icon(AZone *az)
glColor4f(1.f, 1.f, 1.f, 0.8f);
gluQuadricDrawStyle(qobj, GLU_FILL);
- gluDisk( qobj, 0.0, 4.25f, 16, 1);
+ gluDisk(qobj, 0.0, 4.25f, 16, 1);
glColor4f(0.2f, 0.2f, 0.2f, 0.9f);
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- gluDisk( qobj, 0.0, 4.25f, 16, 1);
+ gluDisk(qobj, 0.0, 4.25f, 16, 1);
glDisable(GL_LINE_SMOOTH);
@@ -247,7 +247,7 @@ static void region_draw_azone_tab_plus(AZone *az)
glEnable(GL_BLEND);
/* add code to draw region hidden as 'too small' */
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
break;
@@ -282,7 +282,7 @@ static void region_draw_azone_tab(AZone *az)
glColor4f(col[0], col[1], col[2], 0.5f);
/* add code to draw region hidden as 'too small' */
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA);
@@ -325,7 +325,7 @@ static void region_draw_azone_tria(AZone *az)
glColor4f(0.0f, 0.0f, 0.0f, 0.35f);
/* add code to draw region hidden as 'too small' */
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1+az->x2)/2, (float)az->y2);
break;
@@ -357,8 +357,8 @@ void ED_area_overdraw(bContext *C)
/* Draw AZones, in screenspace */
wmSubWindowSet(win, screen->mainwin);
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (sa= screen->areabase.first; sa; sa= sa->next) {
AZone *az;
@@ -388,7 +388,7 @@ void ED_area_overdraw(bContext *C)
}
}
}
- glDisable( GL_BLEND );
+ glDisable(GL_BLEND);
}
@@ -623,7 +623,7 @@ static void area_azone_initialize(ScrArea *sa)
#define AZONEPAD_ICON 9
static void region_azone_edge(AZone *az, ARegion *ar)
{
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
az->x1= ar->winrct.xmin;
az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
@@ -665,7 +665,7 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
az->x1= ar->winrct.xmax - tot*2*AZONEPAD_ICON;
az->y1= ar->winrct.ymax + AZONEPAD_ICON;
@@ -725,7 +725,7 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
@@ -770,7 +770,7 @@ static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
@@ -815,7 +815,7 @@ static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
@@ -1530,17 +1530,17 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
if (sa->flag & HEADER_NO_PULLDOWN) {
but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
+ ICON_DISCLOSURE_TRI_RIGHT,
+ xco, yco, UI_UNIT_X, UI_UNIT_Y - 2,
+ &(sa->flag), 0, 0, 0, 0,
+ "Show pulldown menus");
}
else {
but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
+ ICON_DISCLOSURE_TRI_DOWN,
+ xco, yco, UI_UNIT_X, UI_UNIT_Y - 2,
+ &(sa->flag), 0, 0, 0, 0,
+ "Hide pulldown menus");
}
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
@@ -1803,7 +1803,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
rect.ymax = ar->winrct.ymax - ar->winrct.ymin;
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0f, 0.0f, 0.0f, alpha);
glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1);
glDisable(GL_BLEND);
@@ -1813,3 +1813,63 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
BLF_position(fontid, 12, rect.ymin + 5, 0.0f);
BLF_draw(fontid, text, BLF_DRAW_STR_DUMMY_MAX);
}
+
+void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
+{
+ float gridsize, gridstep = 1.0f / 32.0f;
+ float fac, blendfac;
+ int x1, y1, x2, y2;
+
+ /* the image is located inside (0, 0), (1, 1) as set by view2d */
+ UI_ThemeColorShade(TH_BACK, 20);
+
+ UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x1, &y1);
+ UI_view2d_to_region_no_clip(&ar->v2d, 1.0f, 1.0f, &x2, &y2);
+ glRectf(x1, y1, x2, y2);
+
+ /* gridsize adapted to zoom level */
+ gridsize = 0.5f * (zoomx + zoomy);
+ if (gridsize <= 0.0f)
+ return;
+
+ if (gridsize < 1.0f) {
+ while (gridsize < 1.0f) {
+ gridsize *= 4.0f;
+ gridstep *= 4.0f;
+ }
+ }
+ else {
+ while (gridsize >= 4.0f) {
+ gridsize /= 4.0f;
+ gridstep /= 4.0f;
+ }
+ }
+
+ /* the fine resolution level */
+ blendfac = 0.25f * gridsize - floorf(0.25f * gridsize);
+ CLAMP(blendfac, 0.0f, 1.0f);
+ UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac)));
+
+ fac = 0.0f;
+ glBegin(GL_LINES);
+ while (fac < 1.0f) {
+ glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
+ fac += gridstep;
+ }
+
+ /* the large resolution level */
+ UI_ThemeColor(TH_BACK);
+
+ fac = 0.0f;
+ while (fac < 1.0f) {
+ glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
+ fac += 4.0f * gridstep;
+ }
+ glEnd();
+}
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 5ba0e86e0c1..50430399f09 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -81,14 +81,14 @@ GLubyte stipple_halftone[128] = {
GLubyte stipple_quarttone[128] = {
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0};
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0};
GLubyte stipple_diag_stripes_pos[128] = {
@@ -195,16 +195,15 @@ void fdrawcheckerboard(float x1, float y1, float x2, float y2)
{
unsigned char col1[4]= {40, 40, 40}, col2[4]= {50, 50, 50};
- GLubyte checker_stipple[32*32/8] = {
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- };
+ GLubyte checker_stipple[32 * 32 / 8] = {
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255};
glColor3ubv(col1);
glRectf(x1, y1, x2, y2);
@@ -370,8 +369,8 @@ void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
set_inverted_drawing(1);
glPushMatrix();
- glTranslatef(xofs, yofs, 0.0);
- glScalef(1,hh/hw,1);
+ glTranslatef(xofs, yofs, 0.0f);
+ glScalef(1.0f, hh / hw, 1.0f);
glutil_draw_lined_arc(0.0, M_PI*2.0, hw, 20);
glPopMatrix();
@@ -786,10 +785,10 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
static int curmode=0;
static int pointhack=0;
-static GLubyte Squaredot[16] = { 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff};
+static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff};
void bglBegin(int mode)
{
@@ -825,7 +824,7 @@ int bglPointHack(void)
void bglVertex3fv(const float vec[3])
{
- switch(curmode) {
+ switch (curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos3fv(vec);
@@ -838,7 +837,7 @@ void bglVertex3fv(const float vec[3])
void bglVertex3f(float x, float y, float z)
{
- switch(curmode) {
+ switch (curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos3f(x, y, z);
@@ -851,7 +850,7 @@ void bglVertex3f(float x, float y, float z)
void bglVertex2fv(const float vec[2])
{
- switch(curmode) {
+ switch (curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos2fv(vec);
@@ -882,11 +881,15 @@ void bgl_get_mats(bglMats *mats)
/* Very strange code here - it seems that certain bad values in the
* modelview matrix can cause gluUnProject to give bad results. */
if (mats->modelview[0] < badvalue &&
- mats->modelview[0] > -badvalue)
- mats->modelview[0]= 0;
+ mats->modelview[0] > -badvalue)
+ {
+ mats->modelview[0] = 0;
+ }
if (mats->modelview[5] < badvalue &&
- mats->modelview[5] > -badvalue)
- mats->modelview[5]= 0;
+ mats->modelview[5] > -badvalue)
+ {
+ mats->modelview[5] = 0;
+ }
/* Set up viewport so that gluUnProject will give correct values */
mats->viewport[0] = 0;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index cafa4527c20..512cd404273 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -963,7 +963,7 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
wmWindow *win= CTX_wm_window(C);
/* generic notes */
- switch(note->category) {
+ switch (note->category) {
case NC_WM:
if (note->data==ND_FILEREAD)
win->screen->do_draw= 1;
@@ -1009,7 +1009,7 @@ void ED_screen_draw(wmWindow *win)
if (sa1 && sa2) {
dir = area_getorientation(sa1, sa2);
if (dir >= 0) {
- switch(dir) {
+ switch (dir) {
case 0: /* W */
dir = 'r';
dira = 'l';
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e427e1e21cf..49672b77d43 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -597,7 +597,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
int deltax, deltay;
int mindelta= sad->az->type==AZONE_REGION?1:12;
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
/* calculate gesture direction */
deltax= (event->x - sad->x);
@@ -735,7 +735,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
{
sActionzoneData *sad= op->customdata;
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
/* second area, for join */
sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
@@ -1045,7 +1045,7 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
int delta, x, y;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
x= RNA_int_get(op->ptr, "x");
@@ -1438,7 +1438,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
int dir;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
dir= RNA_enum_get(op->ptr, "direction");
@@ -1505,13 +1505,13 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_enum_set(op->ptr, "direction", 'h');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
- WM_cursor_set(CTX_wm_window(C),CURSOR_X_MOVE);
+ WM_cursor_set(CTX_wm_window(C), CURSOR_X_MOVE);
}
else {
RNA_enum_set(op->ptr, "direction", 'v');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
- WM_cursor_set(CTX_wm_window(C),CURSOR_Y_MOVE);
+ WM_cursor_set(CTX_wm_window(C), CURSOR_Y_MOVE);
}
}
}
@@ -1711,7 +1711,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
int delta;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
@@ -2262,7 +2262,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
{
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 5d4710accad..553a9a335d7 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -377,7 +377,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
/* check for overlay mode */
if (!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
!(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED)))
+ {
return;
+ }
/* save lots of GL state
* TODO: check on whether all of these are needed? */
@@ -566,7 +568,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW,
SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE))
+ {
outline_col = brush->sub_col;
+ }
/* only do if brush is over the mesh */
if (hit)
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 55cf827fea6..ac327b56fb9 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5038,7 +5038,7 @@ static int paint_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
paint_apply(C, op, &itemptr);
}
RNA_END;
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index b5d6f20aa79..6860b551556 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -530,6 +530,9 @@ static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *p
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
set_brush_rc_props(kmi->ptr, paint, "strength", "use_unified_strength", flags);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", WKEY, KM_PRESS, 0, 0);
+ set_brush_rc_props(kmi->ptr, paint, "weight", "use_unified_weight", flags);
+
if (flags & RC_ROTATION) {
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", NULL, flags);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index fb640346a99..9fe941253f6 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -377,7 +377,7 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
stroke->stroke_started = 1;
}
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
stroke->update_step(C, stroke, &itemptr);
}
RNA_END;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index bd448cc8288..7d847df4175 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2348,7 +2348,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR)
paintweight = 0.0f;
else
- paintweight = ts->vgroup_weight;
+ paintweight = brush_weight(scene, brush);
for (index = 0; index < totindex; index++) {
if (indexar[index] && indexar[index] <= me->totpoly) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 157be337823..8d2dfc8dbfa 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -766,7 +766,7 @@ static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
}
/* Handles clipping against a mirror modifier and SCULPT_LOCK axis flags */
-static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float val[3])
+static void sculpt_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3])
{
int i;
@@ -2817,8 +2817,10 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
/* update the clip tolerance */
if (mmd->tolerance >
ss->cache->clip_tolerance[i])
+ {
ss->cache->clip_tolerance[i] =
- mmd->tolerance;
+ mmd->tolerance;
+ }
}
}
}
@@ -2928,8 +2930,11 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_ROTATE))
- if (!(brush->flag & BRUSH_ACCUMULATE))
+ {
+ if (!(brush->flag & BRUSH_ACCUMULATE)) {
cache->original = 1;
+ }
+ }
cache->special_rotation = (brush->flag & BRUSH_RAKE) ? sd->last_angle : 0;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 89a786d02a9..c08ed2e85b9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -237,7 +237,9 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
else if (unode->maxgrid && dm->getGridData) {
if ((dm->getNumGrids(dm) != unode->maxgrid) ||
(dm->getGridSize(dm) != unode->gridsize))
+ {
continue;
+ }
}
else {
continue;
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index b50c3f11534..73dfde8fd6f 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -221,7 +221,7 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
struct FCurve* fcu;
char driven;
- SEQ_BEGIN(scene->ed, seq) {
+ SEQ_BEGIN (scene->ed, seq) {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
if (fcu || driven)
seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED;
@@ -318,6 +318,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
char filename[FILE_MAX];
Scene *scene;
Main *bmain;
+ int split;
int bitrate, accuracy;
AUD_DeviceSpecs specs;
@@ -333,6 +334,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
specs.format = RNA_enum_get(op->ptr, "format");
container = RNA_enum_get(op->ptr, "container");
codec = RNA_enum_get(op->ptr, "codec");
+ split = RNA_boolean_get(op->ptr, "split_channels");
scene = CTX_data_scene(C);
bmain = CTX_data_main(C);
specs.channels = scene->r.ffcodecdata.audio_channels;
@@ -341,8 +343,12 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
BLI_strncpy(filename, path, sizeof(filename));
BLI_path_abs(filename, bmain->name);
- result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
- accuracy, filename, specs, container, codec, bitrate);
+ if(split)
+ result = AUD_mixdown_per_channel(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
+ accuracy, filename, specs, container, codec, bitrate);
+ else
+ result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
+ accuracy, filename, specs, container, codec, bitrate);
if (result) {
BKE_report(op->reports, RPT_ERROR, result);
@@ -437,8 +443,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
RNA_def_property_flag(prop_codec, PROP_HIDDEN);
RNA_def_property_flag(prop_format, PROP_HIDDEN);
- switch(container)
- {
+ switch (container) {
case AUD_CONTAINER_AC3:
RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
RNA_def_property_enum_items(prop_format, ac3_format_items);
@@ -460,8 +465,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
RNA_def_property_clear_flag(prop_codec, PROP_HIDDEN);
RNA_def_property_enum_items(prop_codec, all_codec_items);
- switch(codec)
- {
+ switch (codec) {
case AUD_CODEC_AAC:
RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
break;
@@ -592,6 +596,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec");
RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format");
RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512);
+ RNA_def_boolean(ot->srna, "split_channels", 0, "Split channels", "Each channel will be rendered into a mono file");
#endif // WITH_AUDASPACE
}
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index b8c310f8477..a44eca17dfd 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -121,7 +121,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_new (wmOperatorType *ot)
+void ACTION_OT_new(wmOperatorType *ot)
{
/* identifiers */
ot->name = "New Action";
@@ -204,7 +204,7 @@ static int act_markers_make_local_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_markers_make_local (wmOperatorType *ot)
+void ACTION_OT_markers_make_local(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Make Markers Local";
@@ -319,7 +319,7 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_previewrange_set (wmOperatorType *ot)
+void ACTION_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Auto-Set Preview Range";
@@ -381,7 +381,7 @@ static int actkeys_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
return actkeys_viewall(C, TRUE);
}
-void ACTION_OT_view_all (wmOperatorType *ot)
+void ACTION_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View All";
@@ -396,7 +396,7 @@ void ACTION_OT_view_all (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void ACTION_OT_view_selected (wmOperatorType *ot)
+void ACTION_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View Selected";
@@ -484,7 +484,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_copy (wmOperatorType *ot)
+void ACTION_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Keyframes";
@@ -535,7 +535,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_paste (wmOperatorType *ot)
+void ACTION_OT_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Keyframes";
@@ -636,7 +636,7 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_keyframe_insert (wmOperatorType *ot)
+void ACTION_OT_keyframe_insert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Insert Keyframes";
@@ -712,7 +712,7 @@ static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
return OPERATOR_FINISHED;
}
-void ACTION_OT_duplicate (wmOperatorType *ot)
+void ACTION_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Keyframes";
@@ -787,7 +787,7 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_delete (wmOperatorType *ot)
+void ACTION_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframes";
@@ -851,7 +851,7 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_clean (wmOperatorType *ot)
+void ACTION_OT_clean(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clean Keyframes";
@@ -915,7 +915,7 @@ static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_sample (wmOperatorType *ot)
+void ACTION_OT_sample(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sample Keyframes";
@@ -1025,7 +1025,7 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_extrapolation_type (wmOperatorType *ot)
+void ACTION_OT_extrapolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Extrapolation";
@@ -1096,7 +1096,7 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_interpolation_type (wmOperatorType *ot)
+void ACTION_OT_interpolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Interpolation";
@@ -1176,7 +1176,7 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_handle_type (wmOperatorType *ot)
+void ACTION_OT_handle_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Handle Type";
@@ -1247,7 +1247,7 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_keyframe_type (wmOperatorType *ot)
+void ACTION_OT_keyframe_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Type";
@@ -1315,7 +1315,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_frame_jump (wmOperatorType *ot)
+void ACTION_OT_frame_jump(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Jump to Frame";
@@ -1415,7 +1415,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_snap (wmOperatorType *ot)
+void ACTION_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Keys";
@@ -1529,7 +1529,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_mirror (wmOperatorType *ot)
+void ACTION_OT_mirror(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mirror Keys";
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index f76f5f6523e..a28f8ee1b99 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -158,7 +158,7 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_all_toggle (wmOperatorType *ot)
+void ACTION_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -524,7 +524,7 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_column (wmOperatorType *ot)
+void ACTION_OT_select_column(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -582,7 +582,7 @@ static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_linked (wmOperatorType *ot)
+void ACTION_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Linked";
@@ -659,7 +659,7 @@ static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_more (wmOperatorType *ot)
+void ACTION_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
@@ -693,7 +693,7 @@ static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_less (wmOperatorType *ot)
+void ACTION_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
@@ -860,7 +860,7 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
return actkeys_select_leftright_exec(C, op);
}
-void ACTION_OT_select_leftright (wmOperatorType *ot)
+void ACTION_OT_select_leftright(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Left/Right";
@@ -1174,7 +1174,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
-void ACTION_OT_clickselect (wmOperatorType *ot)
+void ACTION_OT_clickselect(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Select Keys";
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 9d0dab7d34e..c1875eb3a9a 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -269,12 +269,12 @@ static void action_header_area_draw(const bContext *C, ARegion *ar)
static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_FRAME:
ED_region_tag_redraw(ar);
@@ -282,7 +282,7 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -307,12 +307,12 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
@@ -322,7 +322,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_TRANSFORM:
/* moving object shouldn't need to redraw action */
break;
@@ -334,7 +334,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_EDITED:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index b698ec03668..20d5257a62f 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -535,7 +535,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
/* now for each buttons context type, we try to construct a path,
* tracing back recursively */
- switch(mainb) {
+ switch (mainb) {
case BCONTEXT_SCENE:
case BCONTEXT_RENDER:
found= buttons_context_path_scene(path);
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index fcc5b488ca9..2385bfd75b7 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -56,7 +56,7 @@
static void set_texture_context(bContext *C, SpaceButs *sbuts)
{
- switch(sbuts->mainb) {
+ switch (sbuts->mainb) {
case BCONTEXT_MATERIAL:
sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
break;
@@ -83,7 +83,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
if (!sbuts) /* editor type switch */
return;
- switch(event) {
+ switch (event) {
case B_CONTEXT_SWITCH:
case B_BUTSPREVIEW:
ED_area_tag_redraw(CTX_wm_area(C));
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index f1f4fb37b6e..b2a58041832 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -234,9 +234,9 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
SpaceButs *sbuts= sa->spacedata.first;
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
buttons_area_redraw(sa, BCONTEXT_RENDER);
break;
@@ -262,7 +262,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_TRANSFORM:
buttons_area_redraw(sa, BCONTEXT_OBJECT);
buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */
@@ -307,7 +307,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_GEOM:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SELECT:
case ND_DATA:
ED_area_tag_redraw(sa);
@@ -316,7 +316,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_MATERIAL:
ED_area_tag_redraw(sa);
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SHADING:
case ND_SHADING_DRAW:
case ND_NODES:
@@ -350,7 +350,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case NC_ANIMATION:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_KEYFRAME:
if (wmn->action == NA_EDITED)
ED_area_tag_redraw(sa);
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index eabd64bdc4f..82178e47ae5 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -63,6 +63,11 @@
/* Panels */
+static int clip_grease_pencil_panel_poll(const bContext *UNUSED(C), PanelType *UNUSED(pt))
+{
+ return TRUE;
+}
+
void ED_clip_buttons_register(ARegionType *art)
{
PanelType *pt;
@@ -72,6 +77,7 @@ void ED_clip_buttons_register(ARegionType *art)
strcpy(pt->label, "Grease Pencil");
pt->draw = gpencil_panel_standard;
pt->flag |= PNL_DEFAULT_CLOSED;
+ pt->poll = clip_grease_pencil_panel_poll;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index bf8976035a8..2f9956fc143 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1380,7 +1380,12 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
if (ibuf) {
draw_movieclip_buffer(sc, ar, ibuf, width, height, zoomx, zoomy);
IMB_freeImBuf(ibuf);
+ }
+ else {
+ ED_region_grid_draw(ar, zoomx, zoomy);
+ }
+ if (width && height) {
draw_tracking_tracks(sc, ar, clip, width, height, zoomx, zoomy);
draw_distortion(sc, ar, clip, width, height, zoomx, zoomy);
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 3946d4cc36d..885357a100d 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -35,6 +35,7 @@
#include "BKE_movieclip.h"
#include "BKE_context.h"
#include "BKE_tracking.h"
+
#include "DNA_object_types.h" /* SELECT */
#include "BLI_utildefines.h"
@@ -55,6 +56,8 @@
#include "clip_intern.h" // own include
+/* ******** operactor poll functions ******** */
+
int ED_space_clip_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -65,6 +68,51 @@ int ED_space_clip_poll(bContext *C)
return FALSE;
}
+int ED_space_clip_tracking_poll(bContext *C)
+{
+ SpaceClip *sc= CTX_wm_space_clip(C);
+
+ if (sc && sc->clip)
+ return ED_space_clip_show_trackedit(sc);
+
+ return FALSE;
+}
+
+int ED_space_clip_tracking_size_poll(bContext *C)
+{
+ if (ED_space_clip_tracking_poll(C)) {
+ MovieClip *clip = CTX_data_edit_movieclip(C);
+
+ if (clip) {
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ int width, height;
+
+ BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+
+ return width > 0 && height > 0;
+ }
+ }
+
+ return FALSE;
+}
+
+int ED_space_clip_tracking_frame_poll(bContext *C)
+{
+ if (ED_space_clip_tracking_poll(C)) {
+ MovieClip *clip = CTX_data_edit_movieclip(C);
+
+ if (clip) {
+ SpaceClip *sc = CTX_wm_space_clip(C);
+
+ return BKE_movieclip_has_frame(clip, &sc->user);
+ }
+ }
+
+ return FALSE;
+}
+
+/* ******** editing functions ******** */
+
void ED_space_clip_set(bContext *C, SpaceClip *sc, MovieClip *clip)
{
sc->clip = clip;
@@ -314,3 +362,12 @@ void ED_clip_mouse_pos(bContext *C, wmEvent *event, float co[2])
{
ED_clip_point_stable_pos(C, event->mval[0], event->mval[1], &co[0], &co[1]);
}
+
+int ED_space_clip_show_trackedit(SpaceClip *sc)
+{
+ if (sc) {
+ return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
+ }
+
+ return FALSE;
+}
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index df14491c9c9..4825403fb4a 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -87,60 +87,6 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
glPopMatrix();
}
-static void draw_graph_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
-{
- View2D *v2d = &ar->v2d;
- float xscale, yscale;
- float vec[2];
-
- /* Draw a light green line to indicate current frame */
- vec[0] = (float)(sc->user.framenr * scene->r.framelen);
-
- UI_ThemeColor(TH_CFRAME);
- glLineWidth(2.0);
-
- glBegin(GL_LINE_STRIP);
- vec[1] = v2d->cur.ymin;
- glVertex2fv(vec);
-
- vec[1] = v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- glLineWidth(1.0);
-
- UI_view2d_view_orthoSpecial(ar, v2d, 1);
-
- /* because the frame number text is subject to the same scaling as the contents of the view */
- UI_view2d_getscale(v2d, &xscale, &yscale);
- glScalef(1.0f/xscale, 1.0f, 1.0f);
-
- clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
-
- /* restore view transform */
- glScalef(xscale, 1.0, 1.0);
-}
-
-static void draw_graph_sfra_efra(Scene *scene, View2D *v2d)
-{
- UI_view2d_view_ortho(v2d);
-
- /* currently clip editor supposes that editing clip length is equal to scene frame range */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
-
- glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
- glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
- glDisable(GL_BLEND);
-
- UI_ThemeColorShade(TH_BACK, -60);
-
- /* thin lines where the actual frames are */
- fdrawline((float)SFRA, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
- fdrawline((float)EFRA, v2d->cur.ymin, (float)EFRA, v2d->cur.ymax);
-}
-
static void tracking_segment_point_cb(void *UNUSED(userdata), MovieTrackingTrack *UNUSED(track),
MovieTrackingMarker *marker, int UNUSED(coord), float val)
{
@@ -280,8 +226,8 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
}
/* frame range */
- draw_graph_sfra_efra(scene, v2d);
+ clip_draw_sfra_efra(v2d, scene);
/* current frame */
- draw_graph_cfra(sc, ar, scene);
+ clip_draw_cfra(sc, ar, scene);
}
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index f8c81c2944a..7916a96f98c 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -63,15 +63,13 @@
static int ED_space_clip_graph_poll(bContext *C)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc && sc->clip) {
+ if (ED_space_clip_tracking_poll(C)) {
ARegion *ar = CTX_wm_region(C);
return ar->regiontype == RGN_TYPE_PREVIEW;
}
- return 0;
+ return FALSE;
}
typedef struct {
@@ -82,7 +80,7 @@ static void toggle_selection_cb(void *userdata, MovieTrackingMarker *marker)
{
SelectUserData *data = (SelectUserData *)userdata;
- switch(data->action) {
+ switch (data->action) {
case SEL_SELECT:
marker->flag |= MARKER_GRAPH_SEL;
break;
@@ -486,7 +484,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = delete_curve_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 425a1da9ec5..0b63ae5b12f 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -38,6 +38,7 @@ struct MovieClip;
struct MovieTrackingMarker;
struct MovieTrackingTrack;
struct Scene;
+struct ScrArea;
struct SpaceClip;
struct wmOperatorType;
@@ -81,6 +82,7 @@ void CLIP_OT_rebuild_proxy(struct wmOperatorType *ot);
void CLIP_OT_mode_set(struct wmOperatorType *ot);
/* clip_toolbar.c */
+struct ARegion *ED_clip_has_properties_region(struct ScrArea *sa);
void CLIP_OT_tools(struct wmOperatorType *ot);
void CLIP_OT_properties(struct wmOperatorType *ot);
void ED_clip_tool_props_register(struct ARegionType *art);
@@ -104,6 +106,9 @@ void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct ListB
void clip_view_center_to_point(struct SpaceClip *sc, float x, float y);
+void clip_draw_cfra(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
+void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
+
/* tracking_ops.c */
void CLIP_OT_select(struct wmOperatorType *ot);
void CLIP_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 7e1bbc254e9..c7033b0db99 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -157,7 +157,7 @@ static int open_exec(bContext *C, wmOperator *op)
errno = 0;
- clip = BKE_add_movieclip_file(str);
+ clip = BKE_movieclip_file_add(str);
if (!clip) {
if (op->customdata)
@@ -361,7 +361,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
ViewPanData *vpd = op->customdata;
float offset[2];
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
copy_v2_v2(vpd->vec, &vpd->xorig);
offset[0] = (vpd->x - event->x) / sc->zoom;
@@ -496,7 +496,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
ViewZoomData *vpd = op->customdata;
float factor;
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
factor = 1.0f + (vpd->x-event->x + vpd->y - event->y) / 300.0f;
RNA_float_set(op->ptr, "factor", factor);
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index b80deb8260a..da8bf8fedd9 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -56,7 +56,7 @@
/************************** properties ******************************/
-static ARegion *clip_has_properties_region(ScrArea *sa)
+ARegion *ED_clip_has_properties_region(ScrArea *sa)
{
ARegion *ar, *arnew;
@@ -90,9 +90,9 @@ static int properties_poll(bContext *C)
static int properties_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = clip_has_properties_region(sa);
+ ARegion *ar = ED_clip_has_properties_region(sa);
- if (ar)
+ if (ar && ar->alignment != RGN_ALIGN_NONE)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -167,7 +167,7 @@ static int tools_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = clip_has_tools_region(sa);
- if (ar)
+ if (ar && ar->alignment != RGN_ALIGN_NONE)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 443a1d0cdd3..c8ba8be7eae 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -29,6 +29,7 @@
* \ingroup spclip
*/
+#include "DNA_scene_types.h"
#include "DNA_object_types.h" /* SELECT */
#include "MEM_guardedalloc.h"
@@ -42,6 +43,9 @@
#include "BKE_tracking.h"
#include "BKE_depsgraph.h"
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -53,6 +57,8 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
#include "UI_view2d.h"
#include "clip_intern.h" // own include
@@ -220,3 +226,57 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y)
sc->xof = (x - 0.5f) * width * aspx;
sc->yof = (y - 0.5f) * height * aspy;
}
+
+void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
+{
+ View2D *v2d = &ar->v2d;
+ float xscale, yscale;
+ float vec[2];
+
+ /* Draw a light green line to indicate current frame */
+ vec[0] = (float)(sc->user.framenr * scene->r.framelen);
+
+ UI_ThemeColor(TH_CFRAME);
+ glLineWidth(2.0);
+
+ glBegin(GL_LINE_STRIP);
+ vec[1] = v2d->cur.ymin;
+ glVertex2fv(vec);
+
+ vec[1] = v2d->cur.ymax;
+ glVertex2fv(vec);
+ glEnd();
+
+ glLineWidth(1.0);
+
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
+
+ /* because the frame number text is subject to the same scaling as the contents of the view */
+ UI_view2d_getscale(v2d, &xscale, &yscale);
+ glScalef(1.0f/xscale, 1.0f, 1.0f);
+
+ clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
+
+ /* restore view transform */
+ glScalef(xscale, 1.0, 1.0);
+}
+
+void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
+{
+ UI_view2d_view_ortho(v2d);
+
+ /* currently clip editor supposes that editing clip length is equal to scene frame range */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
+
+ glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
+ glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ glDisable(GL_BLEND);
+
+ UI_ThemeColorShade(TH_BACK, -60);
+
+ /* thin lines where the actual frames are */
+ fdrawline((float)SFRA, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
+ fdrawline((float)EFRA, v2d->cur.ymin, (float)EFRA, v2d->cur.ymax);
+}
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 228c716e3b6..4044568b70d 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -96,7 +96,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
ar->v2d.keeptot = 0;
}
-static ARegion *clip_has_preview_region(const bContext *C, ScrArea *sa)
+static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa)
{
ARegion *ar, *arnew;
@@ -236,9 +236,9 @@ static SpaceLink *clip_duplicate(SpaceLink *sl)
static void clip_listener(ScrArea *sa, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_FRAME:
clip_scopes_tag_refresh(sa);
/* no break! */
@@ -249,14 +249,14 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_MOVIECLIP:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_DISPLAY:
case ND_SELECT:
clip_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
break;
}
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_REMOVED:
case NA_EDITED:
case NA_EVALUATED:
@@ -270,7 +270,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_GEOM:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SELECT:
clip_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
@@ -619,10 +619,13 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, clip_context_dir);
+
return TRUE;
}
else if (CTX_data_equals(member, "edit_movieclip")) {
- CTX_data_id_pointer_set(result, &sc->clip->id);
+ if (sc->clip)
+ CTX_data_id_pointer_set(result, &sc->clip->id);
+
return TRUE;
}
@@ -636,54 +639,163 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- ARegion *ar_preview = clip_has_preview_region(C, sa);
+ ARegion *ar_tools = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
+ ARegion *ar_tool_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS);
+ ARegion *ar_preview = ED_clip_has_preview_region(C, sa);
+ ARegion *ar_properties = ED_clip_has_properties_region(sa);
+ int main_visible = FALSE, preview_visible = FALSE, tools_visible = FALSE;
+ int tool_props_visible = FALSE, properties_visible = FALSE;
int view_changed = FALSE;
switch (sc->view) {
case SC_VIEW_CLIP:
- if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
- ar_preview->flag |= RGN_FLAG_HIDDEN;
- ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
- WM_event_remove_handlers((bContext*)C, &ar_preview->handlers);
- view_changed = TRUE;
- }
- if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
- ar_main->alignment = RGN_ALIGN_NONE;
- view_changed = TRUE;
- }
- if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
- /* store graph region align */
- if (ar_preview->alignment == RGN_ALIGN_TOP)
- sc->runtime_flag &= ~SC_GRAPH_BOTTOM;
- else
- sc->runtime_flag |= SC_GRAPH_BOTTOM;
-
- ar_preview->alignment = RGN_ALIGN_NONE;
- view_changed = TRUE;
- }
+ main_visible = TRUE;
+ preview_visible = FALSE;
+ tools_visible = TRUE;
+ tool_props_visible = TRUE;
+ properties_visible = TRUE;
break;
case SC_VIEW_GRAPH:
- if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
- ar_preview->flag &= ~RGN_FLAG_HIDDEN;
- ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
- ar_preview->v2d.cur = ar_preview->v2d.tot;
- view_changed = TRUE;
- }
- if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
- ar_main->alignment = RGN_ALIGN_NONE;
- view_changed = TRUE;
- }
- if (ar_preview && !ELEM(ar_preview->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
- if (sc->runtime_flag & SC_GRAPH_BOTTOM)
- ar_preview->alignment = RGN_ALIGN_BOTTOM;
- else
- ar_preview->alignment = RGN_ALIGN_TOP;
-
- view_changed = TRUE;
- }
+ main_visible = TRUE;
+ preview_visible = TRUE;
+ tools_visible = TRUE;
+ tool_props_visible = TRUE;
+ properties_visible = TRUE;
break;
}
+ if (main_visible) {
+ if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
+ ar_main->flag &= ~RGN_FLAG_HIDDEN;
+ ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+
+ if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
+ ar_main->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_main && !(ar_main->flag & RGN_FLAG_HIDDEN)) {
+ ar_main->flag |= RGN_FLAG_HIDDEN;
+ ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_main->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
+ ar_main->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (properties_visible) {
+ if (ar_properties && (ar_properties->flag & RGN_FLAG_HIDDEN)) {
+ ar_properties->flag &= ~RGN_FLAG_HIDDEN;
+ ar_properties->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+ if (ar_properties && ar_properties->alignment != RGN_ALIGN_RIGHT) {
+ ar_properties->alignment = RGN_ALIGN_RIGHT;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_properties && !(ar_properties->flag & RGN_FLAG_HIDDEN)) {
+ ar_properties->flag |= RGN_FLAG_HIDDEN;
+ ar_properties->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_properties->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_properties && ar_properties->alignment != RGN_ALIGN_NONE) {
+ ar_properties->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (tools_visible) {
+ if (ar_tools && (ar_tools->flag & RGN_FLAG_HIDDEN)) {
+ ar_tools->flag &= ~RGN_FLAG_HIDDEN;
+ ar_tools->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+ if (ar_tools && ar_tools->alignment != RGN_ALIGN_LEFT) {
+ ar_tools->alignment = RGN_ALIGN_LEFT;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_tools && !(ar_tools->flag & RGN_FLAG_HIDDEN)) {
+ ar_tools->flag |= RGN_FLAG_HIDDEN;
+ ar_tools->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_tools->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_tools && ar_tools->alignment != RGN_ALIGN_NONE) {
+ ar_tools->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (tool_props_visible) {
+ if (ar_tool_props && (ar_tool_props->flag & RGN_FLAG_HIDDEN)) {
+ ar_tool_props->flag &= ~RGN_FLAG_HIDDEN;
+ ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+ if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV))) {
+ ar_tool_props->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_tool_props && !(ar_tool_props->flag & RGN_FLAG_HIDDEN)) {
+ ar_tool_props->flag |= RGN_FLAG_HIDDEN;
+ ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_tool_props->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_tool_props && ar_tool_props->alignment != RGN_ALIGN_NONE) {
+ ar_tool_props->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (preview_visible) {
+ if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
+ ar_preview->flag &= ~RGN_FLAG_HIDDEN;
+ ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
+ ar_preview->v2d.cur = ar_preview->v2d.tot;
+ view_changed = TRUE;
+ }
+ if (ar_preview && !ELEM(ar_preview->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
+ if (sc->runtime_flag & SC_GRAPH_BOTTOM)
+ ar_preview->alignment = RGN_ALIGN_BOTTOM;
+ else
+ ar_preview->alignment = RGN_ALIGN_TOP;
+
+ view_changed = TRUE;
+ }
+ }
+ else {
+ /* store graph region align */
+ if (ar_preview->alignment == RGN_ALIGN_TOP)
+ sc->runtime_flag &= ~SC_GRAPH_BOTTOM;
+ else if (ar_preview->alignment == RGN_ALIGN_BOTTOM)
+ sc->runtime_flag |= SC_GRAPH_BOTTOM;
+
+ if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
+ ar_preview->flag |= RGN_FLAG_HIDDEN;
+ ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_preview->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
+ ar_preview->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
if (view_changed) {
ED_area_initialize(wm, window, sa);
ED_area_tag_redraw(sa);
@@ -808,7 +920,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCREEN:
if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar);
@@ -832,13 +944,13 @@ static void clip_preview_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
-static void clip_preview_area_draw(const bContext *C, ARegion *ar)
+static void graph_area_draw(const bContext *C, ARegion *ar)
{
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
SpaceClip *sc = CTX_wm_space_clip(C);
Scene *scene = CTX_data_scene(C);
- short unitx = V2D_UNIT_FRAMESCALE, unity = V2D_UNIT_VALUES;
+ short unitx, unity;
if (sc->flag & SC_LOCK_TIMECURSOR)
ED_clip_graph_center_current_frame(scene, ar);
@@ -856,11 +968,18 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
+ unitx = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
+ unity = V2D_UNIT_VALUES;
scrollers = UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
+static void clip_preview_area_draw(const bContext *C, ARegion *ar)
+{
+ graph_area_draw(C, ar);
+}
+
static void clip_preview_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
}
@@ -896,7 +1015,7 @@ static void clip_tools_area_draw(const bContext *C, ARegion *ar)
static void clip_props_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_HISTORY)
ED_region_tag_redraw(ar);
@@ -941,7 +1060,7 @@ static void clip_properties_area_draw(const bContext *C, ARegion *ar)
static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCREEN:
if (wmn->data ==ND_GPENCIL)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 35986fa2700..b3bb7464761 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -78,20 +78,6 @@
#include "clip_intern.h" // own include
-static int space_clip_frame_poll(bContext *C)
-{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc) {
- MovieClip *clip = ED_space_clip(sc);
-
- if (clip)
- return BKE_movieclip_has_frame(clip, &sc->user);
- }
-
- return FALSE;
-}
-
/********************** add marker operator *********************/
static void add_marker(SpaceClip *sc, float x, float y)
@@ -156,7 +142,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = add_marker_invoke;
ot->exec = add_marker_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -201,7 +187,7 @@ void CLIP_OT_delete_track(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = delete_track_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -252,7 +238,7 @@ void CLIP_OT_delete_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = delete_marker_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -526,7 +512,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
SlideMarkerData *data = (SlideMarkerData *)op->customdata;
float dx, dy, mdelta[2];
- switch(event->type) {
+ switch (event->type) {
case LEFTCTRLKEY:
case RIGHTCTRLKEY:
case LEFTSHIFTKEY:
@@ -643,7 +629,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
ot->idname = "CLIP_OT_slide_marker";
/* api callbacks */
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
ot->invoke = slide_marker_invoke;
ot->modal = slide_marker_modal;
@@ -857,7 +843,7 @@ void CLIP_OT_select(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_exec;
ot->invoke = select_invoke;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_UNDO;
@@ -934,7 +920,7 @@ void CLIP_OT_select_border(wmOperatorType *ot)
ot->invoke = WM_border_select_invoke;
ot->exec = border_select_exec;
ot->modal = WM_border_select_modal;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_UNDO;
@@ -1018,7 +1004,7 @@ void CLIP_OT_select_circle(wmOperatorType *ot)
ot->invoke = WM_gesture_circle_invoke;
ot->modal = WM_gesture_circle_modal;
ot->exec = circle_select_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1109,7 +1095,7 @@ void CLIP_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_all_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1200,7 +1186,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_groped_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1577,7 +1563,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/* api callbacks */
ot->exec = track_markers_exec;
ot->invoke = track_markers_invoke;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_frame_poll;
ot->modal = track_markers_modal;
/* flags */
@@ -1800,7 +1786,7 @@ void CLIP_OT_solve_camera(wmOperatorType *ot)
ot->exec = solve_camera_exec;
ot->invoke = solve_camera_invoke;
ot->modal = solve_camera_modal;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1848,7 +1834,7 @@ void CLIP_OT_clear_solution(wmOperatorType *ot)
/* api callbacks */
ot->exec = clear_solution_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1900,7 +1886,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
/* api callbacks */
ot->exec = clear_track_path_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1958,7 +1944,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
/* api callbacks */
ot->exec = disable_markers_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2016,7 +2002,7 @@ static Object *get_orientation_object(bContext *C)
static int set_orientation_poll(bContext *C)
{
- if (space_clip_frame_poll(C)) {
+ if (ED_space_clip_tracking_size_poll(C)) {
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
@@ -2626,7 +2612,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_solution_scale_poll(bContext *C)
{
- if (space_clip_frame_poll(C)) {
+ if (ED_space_clip_tracking_size_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -2704,7 +2690,7 @@ void CLIP_OT_set_center_principal(wmOperatorType *ot)
/* api callbacks */
ot->exec = set_center_principal_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2758,7 +2744,7 @@ void CLIP_OT_hide_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = hide_tracks_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2797,7 +2783,7 @@ void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec = hide_tracks_clear_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2879,7 +2865,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
/* api callbacks */
ot->exec = detect_features_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_frame_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2974,7 +2960,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
/* api callbacks */
ot->exec = frame_jump_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3031,7 +3017,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = join_tracks_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3081,7 +3067,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = lock_tracks_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3131,7 +3117,7 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot)
/* api callbacks */
ot->exec = track_copy_color_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3180,7 +3166,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_add_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3240,7 +3226,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_remove_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3283,7 +3269,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_select_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3320,7 +3306,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_set_rotation_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3511,7 +3497,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = clean_tracks_exec;
ot->invoke = clean_tracks_invoke;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3548,7 +3534,7 @@ void CLIP_OT_tracking_object_new(wmOperatorType *ot)
/* api callbacks */
ot->exec = tracking_object_new_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3586,7 +3572,7 @@ void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = tracking_object_remove_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3617,7 +3603,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = copy_tracks_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER;
@@ -3627,7 +3613,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
static int paste_tracks_poll(bContext *C)
{
- if (ED_space_clip_poll(C)) {
+ if (ED_space_clip_tracking_poll(C)) {
return BKE_tracking_clipboard_has_tracks();
}
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 193fa2d2c65..10db1bb1f12 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -82,7 +82,7 @@ enum {
static void do_file_buttons(bContext *C, void *UNUSED(arg), int event)
{
- switch(event) {
+ switch (event) {
case B_FS_FILENAME:
file_filename_exec(C, NULL);
break;
@@ -279,7 +279,7 @@ static int get_file_icon(struct direntry *file)
static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height)
{
uiBut *but;
- int x,y;
+ int x, y;
/*float alpha=1.0f;*/
x = sx;
@@ -301,7 +301,7 @@ static void file_draw_string(int sx, int sy, const char* string, float width, in
fs.align = align;
- BLI_strncpy(fname,string, FILE_MAXFILE);
+ BLI_strncpy(fname, string, FILE_MAXFILE);
file_shorten_string(fname, width + 1.0f, 0);
/* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */
@@ -417,8 +417,7 @@ static void draw_background(FileLayout *layout, View2D *v2d)
int sy;
/* alternating flat shade background */
- for (i=0; (i <= layout->rows); i+=2)
- {
+ for (i=0; (i <= layout->rows); i+=2) {
sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
UI_ThemeColorShade(TH_BACK, -7);
@@ -490,8 +489,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
- for (i=offset; (i < numfiles) && (i<offset+numfiles_layout); ++i)
- {
+ for (i = offset; (i < numfiles) && (i<offset+numfiles_layout); i++) {
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
sx += (int)(v2d->tot.xmin+2.0f);
sy = (int)(v2d->tot.ymax - sy);
@@ -514,7 +512,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
is_icon = 0;
imb = filelist_getimage(files, i);
if (!imb) {
- imb = filelist_geticon(files,i);
+ imb = filelist_geticon(files, i);
is_icon = 1;
}
@@ -528,8 +526,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
UI_ThemeColor4(TH_TEXT);
if (file->selflag & EDITING_FILE) {
- uiBut *but = uiDefBut(block, TEX, 1, "", sx , sy-layout->tile_h-3,
- textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
+ uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy-layout->tile_h-3,
+ textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
uiButClearFlag(but, UI_BUT_UNDO);
@@ -564,14 +562,14 @@ void file_draw_list(const bContext *C, ARegion *ar)
file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
sx += layout->column_widths[COLUMN_MODE3] + 12;
- file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER] , layout->tile_h, align);
+ file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER], layout->tile_h, align);
sx += layout->column_widths[COLUMN_OWNER] + 12;
#endif
file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
sx += (int)layout->column_widths[COLUMN_DATE] + 12;
- file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME] , layout->tile_h, align);
+ file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME], layout->tile_h, align);
sx += (int)layout->column_widths[COLUMN_TIME] + 12;
if (!(file->type & S_IFDIR)) {
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 9455f6390f7..d3598ffd4e7 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -88,7 +88,7 @@ int file_previous_exec(bContext *C, struct wmOperator *unused);
int file_next_exec(bContext *C, struct wmOperator *unused);
int file_filename_exec(bContext *C, struct wmOperator *unused);
int file_directory_exec(bContext *C, struct wmOperator *unused);
-int file_directory_new_exec(bContext *C,struct wmOperator *unused);
+int file_directory_new_exec(bContext *C, struct wmOperator *unused);
int file_delete_exec(bContext *C, struct wmOperator *unused);
int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 7d1981a5a3b..f340c53f528 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -73,7 +73,7 @@
static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion* ar, const rcti* rect)
{
FileSelection sel;
- float fxmin,fymin,fxmax, fymax;
+ float fxmin, fymin, fxmax, fymax;
View2D* v2d = &ar->v2d;
rcti rect_view;
@@ -911,8 +911,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
numfiles = filelist_numfiles(sfile->files);
/* check if we are editing a name */
- for (i=0; i < numfiles; ++i)
- {
+ for (i=0; i < numfiles; ++i) {
if (filelist_is_selected(sfile->files, i, CHECK_ALL) ) {
edit_idx=i;
break;
@@ -1036,7 +1035,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
SpaceFile *sfile= CTX_wm_space_file(C);
if (!sfile->params) {
- BKE_report(op->reports,RPT_WARNING, "No parent directory given");
+ BKE_report(op->reports, RPT_WARNING, "No parent directory given");
return OPERATOR_CANCELLED;
}
@@ -1050,7 +1049,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
if (generate_name) {
/* create a new, non-existing folder name */
if (!new_folder_path(sfile->params->dir, path, name)) {
- BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder name");
+ BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder name");
return OPERATOR_CANCELLED;
}
}
@@ -1059,7 +1058,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
BLI_dir_create_recursive(path);
if (!BLI_exists(path)) {
- BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder");
+ BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder");
return OPERATOR_CANCELLED;
}
@@ -1331,7 +1330,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
/* props */
- RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100);
+ RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100, 100);
}
static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 596721bff07..9fe1940e87b 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -116,7 +116,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
BLI_strncpy(dir, entry, FILE_MAX);
/* create list item */
- but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0,0,UI_UNIT_X*10,UI_UNIT_Y, nr, 0, i, 0, 0, entry);
+ but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nr, 0, i, 0, 0, entry);
uiButSetFunc(but, file_panel_cb, entry, NULL);
uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 45a271cc7e9..107acbf49b1 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -179,7 +179,7 @@ static int compare_name(const void *a1, const void *a2)
if ( strcmp(entry1->relname, "..")==0 ) return (-1);
if ( strcmp(entry2->relname, "..")==0 ) return (1);
- return (BLI_natstrcmp(entry1->relname,entry2->relname));
+ return (BLI_natstrcmp(entry1->relname, entry2->relname));
}
static int compare_date(const void *a1, const void *a2)
@@ -212,7 +212,7 @@ static int compare_date(const void *a1, const void *a2)
if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
- else return BLI_natstrcmp(entry1->relname,entry2->relname);
+ else return BLI_natstrcmp(entry1->relname, entry2->relname);
}
static int compare_size(const void *a1, const void *a2)
@@ -244,7 +244,7 @@ static int compare_size(const void *a1, const void *a2)
if ( entry1->s.st_size < entry2->s.st_size) return 1;
if ( entry1->s.st_size > entry2->s.st_size) return -1;
- else return BLI_natstrcmp(entry1->relname,entry2->relname);
+ else return BLI_natstrcmp(entry1->relname, entry2->relname);
}
static int compare_extension(const void *a1, const void *a2)
@@ -419,7 +419,7 @@ void filelist_free_icons(void)
//-----------------FOLDERLIST (previous/next) --------------//
struct ListBase* folderlist_new(void)
{
- ListBase* p = MEM_callocN( sizeof(ListBase), "folderlist" );
+ ListBase* p = MEM_callocN(sizeof(ListBase), "folderlist" );
return p;
}
@@ -456,7 +456,7 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir)
}
// create next folder element
- folder = (FolderList*)MEM_mallocN(sizeof(FolderList),"FolderList");
+ folder = (FolderList*)MEM_mallocN(sizeof(FolderList), "FolderList");
folder->foldername = (char*)MEM_mallocN(sizeof(char)*(strlen(dir)+1), "foldername");
folder->foldername[0] = '\0';
@@ -519,8 +519,8 @@ static void filelist_read_dir(struct FileList* filelist);
//------------------FILELIST------------------------//
struct FileList* filelist_new(short type)
{
- FileList* p = MEM_callocN( sizeof(FileList), "filelist" );
- switch(type) {
+ FileList* p = MEM_callocN(sizeof(FileList), "filelist" );
+ switch (type) {
case FILE_MAIN:
p->readf = filelist_read_main;
p->filterf = is_filtered_main;
@@ -982,7 +982,7 @@ int filelist_is_selected(struct FileList* filelist, int index, FileCheckType che
void filelist_sort(struct FileList* filelist, short sort)
{
- switch(sort) {
+ switch (sort) {
case FILE_SORT_ALPHA:
qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_name);
break;
@@ -1144,7 +1144,7 @@ void filelist_from_main(struct FileList *filelist)
filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
for (a=0; a<filelist->numfiles; a++) {
- memset( &(filelist->filelist[a]), 0 , sizeof(struct direntry));
+ memset(&(filelist->filelist[a]), 0, sizeof(struct direntry));
filelist->filelist[a].type |= S_IFDIR;
}
@@ -1198,7 +1198,7 @@ void filelist_from_main(struct FileList *filelist)
files = filelist->filelist;
if (!filelist->hide_parent) {
- memset( &(filelist->filelist[0]), 0 , sizeof(struct direntry));
+ memset(&(filelist->filelist[0]), 0, sizeof(struct direntry));
filelist->filelist[0].relname= BLI_strdup("..");
filelist->filelist[0].type |= S_IFDIR;
@@ -1212,7 +1212,7 @@ void filelist_from_main(struct FileList *filelist)
ok = 1;
if (ok) {
if (!filelist->hide_dot || id->name[2] != '.') {
- memset( files, 0 , sizeof(struct direntry));
+ memset(files, 0, sizeof(struct direntry));
if (id->lib==NULL)
files->relname= BLI_strdup(id->name+2);
else {
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 31695ddd776..b17ca5ee319 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -447,8 +447,7 @@ static void column_widths(struct FileList* files, struct FileLayout* layout)
layout->column_widths[i] = 0;
}
- for (i=0; (i < numfiles); ++i)
- {
+ for (i=0; (i < numfiles); ++i) {
struct direntry* file = filelist_file(files, i);
if (file) {
float len;
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 48449ac8870..0c94bff8803 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -99,7 +99,7 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu* fsmenu, FSMenuCategory ca
{
FSMenuEntry *fsms = NULL;
- switch(category) {
+ switch (category) {
case FS_CATEGORY_SYSTEM:
fsms = fsmenu->fsmenu_system;
break;
@@ -115,7 +115,7 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu* fsmenu, FSMenuCategory ca
static void fsmenu_set_category(struct FSMenu* fsmenu, FSMenuCategory category, FSMenuEntry *fsms)
{
- switch(category) {
+ switch (category) {
case FS_CATEGORY_SYSTEM:
fsmenu->fsmenu_system = fsms;
break;
@@ -268,8 +268,7 @@ void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
fp = BLI_fopen(filename, "r");
if (!fp) return;
- while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
- {
+ while ( fgets ( line, 256, fp ) != NULL ) { /* read a line */
if (strncmp(line, "[Bookmarks]", 11)==0) {
category = FS_CATEGORY_BOOKMARKS;
}
@@ -316,7 +315,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
/* Adding Desktop and My Documents */
SHGetSpecialFolderPath(0, line, CSIDL_PERSONAL, 0);
- fsmenu_insert_entry(fsmenu,FS_CATEGORY_BOOKMARKS, line, 1, 0);
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
SHGetSpecialFolderPath(0, line, CSIDL_DESKTOPDIRECTORY, 0);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
}
@@ -329,8 +328,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
const char *home;
/* loop through all the OS X Volumes, and add them to the SYSTEM section */
- for (i=1; err!=nsvErr; i++)
- {
+ for (i = 1; err != nsvErr; i++) {
FSRef dir;
unsigned char path[FILE_MAX];
@@ -389,8 +387,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathesArray = LSSharedFileListCopySnapshot(list, &seed);
pathesCount = CFArrayGetCount(pathesArray);
- for (i=0; i<pathesCount; i++)
- {
+ for (i=0; i<pathesCount; i++) {
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
@@ -402,7 +399,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
- if (!CFStringGetCString(pathString,line,256,kCFStringEncodingASCII))
+ if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII))
continue;
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, 1, 0);
@@ -415,8 +412,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
/* Then get network volumes */
err = noErr;
- for (i=1; err!=nsvErr; i++)
- {
+ for (i=1; err!=nsvErr; i++) {
FSRef dir;
FSVolumeRefNum volRefNum;
struct GetVolParmsInfoBuffer volParmsBuffer;
@@ -440,8 +436,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathesArray = LSSharedFileListCopySnapshot(list, &seed);
pathesCount = CFArrayGetCount(pathesArray);
- for (i=0; i<pathesCount; i++)
- {
+ for (i=0; i<pathesCount; i++) {
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
@@ -453,7 +448,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
- if (!CFStringGetCString(pathString,line,256,kCFStringEncodingASCII))
+ if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII))
continue;
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 0cf15c22efa..dac5d1e1347 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -218,7 +218,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
}
else {
if (params->display == FILE_IMGDISPLAY) {
- if (!thumbnails_running(sfile->files,C)) {
+ if (!thumbnails_running(sfile->files, C)) {
thumbnails_start(sfile->files, C);
}
}
@@ -251,7 +251,7 @@ static void file_listener(ScrArea *sa, wmNotifier *wmn)
/* SpaceFile* sfile = (SpaceFile*)sa->spacedata.first; */
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
@@ -287,7 +287,7 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
static void file_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
@@ -432,12 +432,12 @@ static void file_keymap(struct wmKeyConfig *keyconf)
RNA_int_set(kmi->ptr, "increment", 10);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
RNA_int_set(kmi->ptr, "increment", 100);
- kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, 0,0);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "increment", -1);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_SHIFT, 0);
RNA_int_set(kmi->ptr, "increment", -10);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_CTRL, 0);
- RNA_int_set(kmi->ptr, "increment",-100);
+ RNA_int_set(kmi->ptr, "increment", -100);
/* keys for button area (top) */
@@ -450,10 +450,10 @@ static void file_keymap(struct wmKeyConfig *keyconf)
RNA_int_set(kmi->ptr, "increment", 100);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "increment", -1);
- kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_SHIFT,0);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_SHIFT, 0);
RNA_int_set(kmi->ptr, "increment", -10);
- kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_CTRL,0);
- RNA_int_set(kmi->ptr, "increment",-100);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_CTRL, 0);
+ RNA_int_set(kmi->ptr, "increment", -100);
}
@@ -476,7 +476,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar)
static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
}
}
@@ -536,7 +536,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
static void file_ui_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 4d2fe2cd568..8bc2eda7e33 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -85,7 +85,7 @@ static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int
{
//Scene *scene= CTX_data_scene(C);
- switch(event) {
+ switch (event) {
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index fc84cfc46a2..e772e2856c1 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -532,7 +532,7 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2
glBegin(GL_LINE_STRIP);
for (ctime= stime; ctime <= etime; ctime += samplefreq)
- glVertex2f( ctime, evaluate_fcurve(fcu, ctime)*unitFac );
+ glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac);
glEnd();
@@ -720,8 +720,8 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
correct_bezpart(v1, v2, v3, v4);
- forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float)*3);
- forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data+1, resol, sizeof(float)*3);
+ BKE_curve_forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float)*3);
+ BKE_curve_forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data+1, resol, sizeof(float)*3);
for (fp= data; resol; resol--, fp+= 3)
glVertex2fv(fp);
@@ -777,7 +777,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)
+void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
{
FCurve *fcu;
@@ -812,7 +812,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
/* This is called twice from space_graph.c -> graph_main_area_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
-void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
+void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
{
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 76a2c926522..5f8281fda5b 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -83,7 +83,7 @@
/* Get the min/max keyframes*/
/* note: it should return total boundbox, filter for selection only can be argument... */
-void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly)
+void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -181,7 +181,7 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_previewrange_set (wmOperatorType *ot)
+void GRAPH_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Auto-Set Preview Range";
@@ -243,7 +243,7 @@ static int graphkeys_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
return graphkeys_viewall(C, TRUE);
}
-void GRAPH_OT_view_all (wmOperatorType *ot)
+void GRAPH_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View All";
@@ -258,7 +258,7 @@ void GRAPH_OT_view_all (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void GRAPH_OT_view_selected (wmOperatorType *ot)
+void GRAPH_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View Selected";
@@ -373,7 +373,7 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_ghost_curves_create (wmOperatorType *ot)
+void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Create Ghost Curves";
@@ -416,7 +416,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_ghost_curves_clear (wmOperatorType *ot)
+void GRAPH_OT_ghost_curves_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Ghost Curves";
@@ -511,7 +511,7 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_keyframe_insert (wmOperatorType *ot)
+void GRAPH_OT_keyframe_insert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Insert Keyframes";
@@ -618,7 +618,7 @@ static int graphkeys_click_insert_invoke (bContext *C, wmOperator *op, wmEvent *
return graphkeys_click_insert_exec(C, op);
}
-void GRAPH_OT_click_insert (wmOperatorType *ot)
+void GRAPH_OT_click_insert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Click-Insert Keyframes";
@@ -701,7 +701,7 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_copy (wmOperatorType *ot)
+void GRAPH_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Keyframes";
@@ -746,7 +746,7 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_paste (wmOperatorType *ot)
+void GRAPH_OT_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Keyframes";
@@ -815,7 +815,7 @@ static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
return OPERATOR_FINISHED;
}
-void GRAPH_OT_duplicate (wmOperatorType *ot)
+void GRAPH_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Keyframes";
@@ -885,7 +885,7 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_delete (wmOperatorType *ot)
+void GRAPH_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframes";
@@ -947,7 +947,7 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_clean (wmOperatorType *ot)
+void GRAPH_OT_clean(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clean Keyframes";
@@ -1030,7 +1030,7 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_bake (wmOperatorType *ot)
+void GRAPH_OT_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Curve";
@@ -1174,7 +1174,7 @@ static int graphkeys_sound_bake_invoke (bContext *C, wmOperator *op, wmEvent *ev
return WM_operator_filesel(C, op, event);
}
-void GRAPH_OT_sound_bake (wmOperatorType *ot)
+void GRAPH_OT_sound_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Sound to F-Curves";
@@ -1248,7 +1248,7 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_sample (wmOperatorType *ot)
+void GRAPH_OT_sample(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sample Keyframes";
@@ -1357,7 +1357,7 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_extrapolation_type (wmOperatorType *ot)
+void GRAPH_OT_extrapolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Extrapolation";
@@ -1426,7 +1426,7 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_interpolation_type (wmOperatorType *ot)
+void GRAPH_OT_interpolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Interpolation";
@@ -1697,7 +1697,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
}
}
-void GRAPH_OT_euler_filter (wmOperatorType *ot)
+void GRAPH_OT_euler_filter(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Euler Discontinuity Filter";
@@ -1771,7 +1771,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_frame_jump (wmOperatorType *ot)
+void GRAPH_OT_frame_jump(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Jump to Frame";
@@ -1875,7 +1875,7 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_snap (wmOperatorType *ot)
+void GRAPH_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Keys";
@@ -1993,7 +1993,7 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_mirror (wmOperatorType *ot)
+void GRAPH_OT_mirror(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mirror Keys";
@@ -2048,7 +2048,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_smooth (wmOperatorType *ot)
+void GRAPH_OT_smooth(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Smooth Keys";
@@ -2152,7 +2152,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
+void GRAPH_OT_fmodifier_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add F-Curve Modifier";
@@ -2210,7 +2210,7 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_fmodifier_copy (wmOperatorType *ot)
+void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy F-Modifiers";
@@ -2272,7 +2272,7 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
}
}
-void GRAPH_OT_fmodifier_paste (wmOperatorType *ot)
+void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste F-Modifiers";
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 864708a873a..7c72fa0834d 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -166,7 +166,7 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
+void GRAPH_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -535,7 +535,7 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_column (wmOperatorType *ot)
+void GRAPH_OT_select_column(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -593,7 +593,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_linked (wmOperatorType *ot)
+void GRAPH_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Linked";
@@ -671,7 +671,7 @@ static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_more (wmOperatorType *ot)
+void GRAPH_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
@@ -705,7 +705,7 @@ static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_less (wmOperatorType *ot)
+void GRAPH_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
@@ -846,7 +846,7 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
return graphkeys_select_leftright_exec(C, op);
}
-void GRAPH_OT_select_leftright (wmOperatorType *ot)
+void GRAPH_OT_select_leftright(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Left/Right";
@@ -1331,7 +1331,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
-void GRAPH_OT_clickselect (wmOperatorType *ot)
+void GRAPH_OT_clickselect(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Select Keys";
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 8c2afe8a242..46c886b7d3c 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -92,7 +92,7 @@ bAnimListElem *get_active_fcurve_channel (bAnimContext *ac)
/* Operator Polling Callbacks */
/* Check if there are any visible keyframes (for selection tools) */
-int graphop_visible_keyframes_poll (bContext *C)
+int graphop_visible_keyframes_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -141,7 +141,7 @@ int graphop_visible_keyframes_poll (bContext *C)
}
/* Check if there are any visible + editable keyframes (for editing tools) */
-int graphop_editable_keyframes_poll (bContext *C)
+int graphop_editable_keyframes_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -191,7 +191,7 @@ int graphop_editable_keyframes_poll (bContext *C)
}
/* has active F-Curve that's editable */
-int graphop_active_fcurve_poll (bContext *C)
+int graphop_active_fcurve_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -226,7 +226,7 @@ int graphop_active_fcurve_poll (bContext *C)
}
/* has selected F-Curve that's editable */
-int graphop_selected_fcurve_poll (bContext *C)
+int graphop_selected_fcurve_poll(bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 37cdbd4963a..1b60a0a39ac 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -374,12 +374,12 @@ static void graph_buttons_area_draw(const bContext *C, ARegion *ar)
static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
@@ -393,7 +393,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -406,7 +406,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_EDITED:
case NA_SELECTED:
ED_region_tag_redraw(ar);
@@ -516,6 +516,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) {
ANIM_sync_animchannels_to_data(C);
sipo->flag &= ~SIPO_TEMP_NEEDCHANSYNC;
+ ED_area_tag_redraw(sa);
}
/* init/adjust F-Curve colors */
@@ -551,21 +552,21 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
* TODO: find a way to module the hue so that not all curves have same color...
*/
float *col= fcu->color;
-
- switch(fcu->array_index) {
- case 0:
- col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f;
- break;
- case 1:
- col[0]= 0.0f; col[1]= 1.0f; col[2]= 0.0f;
- break;
- case 2:
- col[0]= 0.0f; col[1]= 0.0f; col[2]= 1.0f;
- break;
- default:
- /* 'unknown' color - bluish so as to not conflict with handles */
- col[0]= 0.3f; col[1]= 0.8f; col[2]= 1.0f;
- break;
+
+ switch (fcu->array_index) {
+ case 0:
+ col[0] = 1.0f; col[1] = 0.0f; col[2] = 0.0f;
+ break;
+ case 1:
+ col[0] = 0.0f; col[1] = 1.0f; col[2] = 0.0f;
+ break;
+ case 2:
+ col[0] = 0.0f; col[1] = 0.0f; col[2] = 1.0f;
+ break;
+ default:
+ /* 'unknown' color - bluish so as to not conflict with handles */
+ col[0] = 0.3f; col[1] = 0.8f; col[2] = 1.0f;
+ break;
}
}
break;
@@ -596,55 +597,55 @@ void ED_spacetype_ipo(void)
st->spaceid= SPACE_IPO;
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
- st->new= graph_new;
- st->free= graph_free;
- st->init= graph_init;
- st->duplicate= graph_duplicate;
- st->operatortypes= graphedit_operatortypes;
- st->keymap= graphedit_keymap;
- st->listener= graph_listener;
- st->refresh= graph_refresh;
+ st->new = graph_new;
+ st->free = graph_free;
+ st->init = graph_init;
+ st->duplicate = graph_duplicate;
+ st->operatortypes = graphedit_operatortypes;
+ st->keymap = graphedit_keymap;
+ st->listener = graph_listener;
+ st->refresh = graph_refresh;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= graph_main_area_init;
- art->draw= graph_main_area_draw;
- art->listener= graph_region_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->init = graph_main_area_init;
+ art->draw = graph_main_area_draw;
+ art->listener = graph_region_listener;
+ art->keymapflag = ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
- art->listener= graph_region_listener;
- art->init= graph_header_area_init;
- art->draw= graph_header_area_draw;
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
+ art->listener = graph_region_listener;
+ art->init = graph_header_area_init;
+ art->draw = graph_header_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex= 200+V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
- art->listener= graph_region_listener;
- art->init= graph_channel_area_init;
- art->draw= graph_channel_area_draw;
+ art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+ art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+ art->listener = graph_region_listener;
+ art->init = graph_channel_area_init;
+ art->draw = graph_channel_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: UI buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_UI;
- art->prefsizex= 200;
- art->keymapflag= ED_KEYMAP_UI;
- art->listener= graph_region_listener;
- art->init= graph_buttons_area_init;
- art->draw= graph_buttons_area_draw;
+ art->prefsizex = 200;
+ art->keymapflag = ED_KEYMAP_UI;
+ art->listener = graph_region_listener;
+ art->init = graph_buttons_area_init;
+ art->draw = graph_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 29bd5f5117d..793e5712c8c 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -334,65 +334,6 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
/* image drawing */
-static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
-{
- float gridsize, gridstep = 1.0f / 32.0f;
- float fac, blendfac;
- int x1, y1, x2, y2;
-
- /* the image is located inside (0,0),(1, 1) as set by view2d */
- UI_ThemeColorShade(TH_BACK, 20);
-
- UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x1, &y1);
- UI_view2d_to_region_no_clip(&ar->v2d, 1.0f, 1.0f, &x2, &y2);
- glRectf(x1, y1, x2, y2);
-
- /* gridsize adapted to zoom level */
- gridsize = 0.5f * (zoomx + zoomy);
- if (gridsize <= 0.0f) return;
-
- if (gridsize < 1.0f) {
- while (gridsize < 1.0f) {
- gridsize *= 4.0f;
- gridstep *= 4.0f;
- }
- }
- else {
- while (gridsize >= 4.0f) {
- gridsize /= 4.0f;
- gridstep /= 4.0f;
- }
- }
-
- /* the fine resolution level */
- blendfac = 0.25f * gridsize - floorf(0.25f * gridsize);
- CLAMP(blendfac, 0.0f, 1.0f);
- UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac)));
-
- fac = 0.0f;
- glBegin(GL_LINES);
- while (fac < 1.0f) {
- glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
- fac += gridstep;
- }
-
- /* the large resolution level */
- UI_ThemeColor(TH_BACK);
-
- fac = 0.0f;
- while (fac < 1.0f) {
- glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
- fac += 4.0f * gridstep;
- }
- glEnd();
-}
-
static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, unsigned int *recti)
{
@@ -781,7 +722,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
/* draw the image or grid */
if (ibuf == NULL)
- draw_image_grid(ar, zoomx, zoomy);
+ ED_region_grid_draw(ar, zoomx, zoomy);
else if (sima->flag & SI_DRAW_TILE)
draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy);
else if (ima && (ima->tpageflag & IMA_TILES))
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2c688990a8f..d9f3ffafb14 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -190,13 +190,14 @@ int space_image_main_area_poll(bContext *C)
return 0;
}
-/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode */
+/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */
int space_image_main_area_not_uv_brush_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *toolsettings = scene->toolsettings;
- ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
- if (sima && !toolsettings->uvsculpt)
+ if (sima && !toolsettings->uvsculpt && !scene->obedit)
return 1;
return 0;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 08aa69fe499..447028b8bef 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -205,7 +205,9 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy)
if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
(ima->aspx == 0.0f || ima->aspy == 0.0f))
+ {
return;
+ }
/* x is always 1 */
*aspy = ima->aspy / ima->aspx;
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 1c2f43f67a4..2ef8f6c306c 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -183,7 +183,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
BezTriple *bezt;
BPoint *bp;
int a;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
for (nu = nurbs->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index dcead6c01db..22df7432ecb 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -104,7 +104,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
float mcoords[256][2];
int i= 0;
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
@@ -119,8 +119,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
uiBlock *block;
uiLinkLine *line, *nline;
uiBut *but;
- for (block= ar->uiblocks.first; block; block= block->next)
- {
+ for (block= ar->uiblocks.first; block; block= block->next) {
but= block->buttons.first;
while (but) {
if (but->type==LINK && but->link) {
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index cac4fe04765..1e976cebafd 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -198,7 +198,7 @@ static int edit_actuator_invoke_properties(bContext *C, wmOperator *op)
bActuator *act = ptr.data;
Object *ob = ptr.id.data;
- RNA_string_set(op->ptr, "actuator",act->name);
+ RNA_string_set(op->ptr, "actuator", act->name);
RNA_string_set(op->ptr, "object", ob->id.name+2);
return 1;
}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index f7c69c80067..184357344e1 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -371,7 +371,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
ob= CTX_data_active_object(C);
if (ob==NULL) return;
- switch(event) {
+ switch (event) {
case B_SETPROP:
/* check for inconsistent types */
@@ -551,13 +551,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
didit= 0;
for (ob=bmain->object.first; ob; ob=ob->id.next) {
act= ob->actuators.first;
- while (act)
- {
- if (act->type==ACT_SOUND)
- {
+ while (act) {
+ if (act->type==ACT_SOUND) {
bSoundActuator *sa= act->data;
- if (sa->sndnr)
- {
+ if (sa->sndnr) {
ID *sound= bmain->sound.first;
int nr= 1;
@@ -567,8 +564,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
}
- while (sound)
- {
+ while (sound) {
if (nr==sa->sndnr)
break;
nr++;
@@ -727,8 +723,7 @@ static const char *actuator_name(int type)
static const char *actuator_pup(Object *owner)
{
- switch (owner->type)
- {
+ switch (owner->type) {
case OB_ARMATURE:
return "Actuators %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
"|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
@@ -914,7 +909,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
if (*count==0) return NULL;
if (*count>24) *count= 24; /* temporal */
- idar= MEM_callocN( (*count)*sizeof(void *), "idar");
+ idar= MEM_callocN((*count)*sizeof(void *), "idar");
ob= bmain->object.first;
nr= 0;
@@ -945,7 +940,7 @@ static int get_col_sensor(int type)
{
/* XXX themecolors not here */
- switch(type) {
+ switch (type) {
case SENS_ALWAYS: return TH_PANEL;
case SENS_DELAY: return TH_PANEL;
case SENS_TOUCH: return TH_PANEL;
@@ -1161,8 +1156,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
set_col_sensor(sens->type, 0);
- switch (sens->type)
- {
+ switch (sens->type) {
case SENS_ALWAYS:
{
ysize= 24;
@@ -1187,9 +1181,9 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
ts= sens->data;
- // uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
- uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:",(short)(xco + 10),(short)(yco-44), (short)(width - 20), 19, &ts->ma, "Only look for floors with this Material");
- // uiDefButF(block, NUM, 1, "Margin:", xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity");
+ // uiDefBut(block, TEX, 1, "Property:", xco, yco-22, width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
+ uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:", (short)(xco + 10), (short)(yco-44), (short)(width - 20), 19, &ts->ma, "Only look for floors with this Material");
+ // uiDefButF(block, NUM, 1, "Margin:", xco+width/2, yco-44, width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity");
yco-= ysize;
break;
}
@@ -1206,11 +1200,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
/* The collision sensor will become a generic collision (i.e. it */
/* absorb the old touch sensor). */
- uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse",(short)(xco + 10),(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse", (short)(xco + 10), (short)(yco - 44),
(short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
"Changes to the set of colliding objects generated pulses");
- uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10 + (0.20 * (width-20))),(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P", (short)(xco + 10 + (0.20 * (width-20))), (short)(yco - 44),
(short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
"Toggle collision on material or property");
@@ -1225,7 +1219,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
"Only look for Objects with this property");
}
- /* uiDefButS(block, NUM, 1, "Damp:", xco+10+width-90,yco-24, 70, 19, &cs->damp, 0, 250, 0, 0, "For 'damp' time don't detect another collision"); */
+ /* uiDefButS(block, NUM, 1, "Damp:", xco+10+width-90, yco-24, 70, 19, &cs->damp, 0, 250, 0, 0, "For 'damp' time don't detect another collision"); */
yco-= ysize;
break;
@@ -1240,11 +1234,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
ns= sens->data;
- uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
+ uiDefBut(block, TEX, 1, "Property:", (short)(10+xco), (short)(yco-44), (short)(width-20), 19,
&ns->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
- uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
+ uiDefButF(block, NUM, 1, "Dist", (short)(10+xco), (short)(yco-68), (short)((width-22)/2), 19,
&ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
- uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
+ uiDefButF(block, NUM, 1, "Reset", (short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
&ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance");
yco-= ysize;
break;
@@ -1261,7 +1255,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
rs= sens->data;
uiDefBut(block, TEX, 1, "Prop:",
- (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
+ (short)(10+xco), (short)(yco-44), (short)(0.7 * (width-20)), 19,
&rs->name, 0, MAX_NAME, 0, 0,
"Only look for Objects with this property");
@@ -1344,27 +1338,25 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3";
/* str= "Type %t|Equal %x0|Not Equal %x1"; */
- uiDefButI(block, MENU, B_REDR, str, xco+30,yco-44,width-60, 19,
+ uiDefButI(block, MENU, B_REDR, str, xco+30, yco-44, width-60, 19,
&ps->type, 0, 31, 0, 0, "Type");
- if (ps->type != SENS_PROP_EXPRESSION)
- {
- uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
+ if (ps->type != SENS_PROP_EXPRESSION) {
+ uiDefBut(block, TEX, 1, "Prop: ", xco+30, yco-68, width-60, 19,
ps->name, 0, MAX_NAME, 0, 0, "Property name");
}
- if (ps->type == SENS_PROP_INTERVAL)
- {
- uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
+ if (ps->type == SENS_PROP_INTERVAL) {
+ uiDefBut(block, TEX, 1, "Min: ", xco, yco-92, width/2, 19,
ps->value, 0, MAX_NAME, 0, 0, "check for min value");
- uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
+ uiDefBut(block, TEX, 1, "Max: ", xco+width/2, yco-92, width/2, 19,
ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value");
}
else if (ps->type == SENS_PROP_CHANGED) {
/* pass */
}
else {
- uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
+ uiDefBut(block, TEX, 1, "Value: ", xco+30, yco-92, width-60, 19,
ps->value, 0, MAX_NAME, 0, 0, "check for value");
}
@@ -1398,12 +1390,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
str= "Type %t|State changed %x0|Lin error below %x1|Lin error above %x2|Rot error below %x3|Rot error above %x4";
- uiDefButI(block, MENU, B_REDR, str, xco+10,yco-66,0.4*(width-20), 19,
+ uiDefButI(block, MENU, B_REDR, str, xco+10, yco-66, 0.4*(width-20), 19,
&arm->type, 0, 31, 0, 0, "Type");
- if (arm->type != SENS_ARM_STATE_CHANGED)
- {
- uiDefButF(block, NUM, 1, "Value: ", xco+10+0.4*(width-20),yco-66,0.6*(width-20), 19,
+ if (arm->type != SENS_ARM_STATE_CHANGED) {
+ uiDefButF(block, NUM, 1, "Value: ", xco+10+0.4*(width-20), yco-66, 0.6*(width-20), 19,
&arm->value, -10000.0, 10000.0, 100, 0, "Test the error against this value");
}
}
@@ -1421,7 +1412,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
as= sens->data;
- uiDefBut(block, TEX, 1, "Act: ", xco+30,yco-44,width-60, 19,
+ uiDefBut(block, TEX, 1, "Act: ", xco+30, yco-44, width-60, 19,
as->name, 0, MAX_NAME, 0, 0, "Actuator name, actuator active state modifications will be detected");
yco-= ysize;
break;
@@ -1437,11 +1428,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
ds = sens->data;
- uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
+ uiDefButS(block, NUM, 0, "Delay", (short)(10+xco), (short)(yco-44), (short)((width-22)*0.4+10), 19,
&ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of logic tics before the positive trigger (default 60 per second)");
- uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
+ uiDefButS(block, NUM, 0, "Dur", (short)(10+xco+(width-22)*0.4+10), (short)(yco-44), (short)((width-22)*0.4-10), 19,
&ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
- uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP", (short)(xco + 10 + (width-22)*0.8), (short)(yco - 44),
(short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
"Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
yco-= ysize;
@@ -1471,7 +1462,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
"Specify the type of event this mouse sensor should trigger on");
if (ms->type==32) {
- uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse", (short)(xco + 10) + (width*0.8f)-20, (short)(yco - 44),
(short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
"Moving the mouse over a different object generates a pulse");
}
@@ -1489,9 +1480,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
randomSensor = sens->data;
/* some files were wrongly written, avoid crash now */
- if (randomSensor)
- {
- uiDefButI(block, NUM, 1, "Seed: ", xco+10,yco-44,(width-20), 19,
+ if (randomSensor) {
+ uiDefButI(block, NUM, 1, "Seed: ", xco+10, yco-44, (width-20), 19,
&randomSensor->seed, 0, 1000, 0, 0,
"Initial seed of the generator. (Choose 0 for not random)");
}
@@ -1509,7 +1499,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
/* 1. property or material */
uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
- xco + 10,yco - 44, 0.20 * (width-20), 19,
+ xco + 10, yco - 44, 0.20 * (width-20), 19,
&raySens->mode, 0.0, 0.0, 0, 0,
"Toggle collision on material or property");
@@ -1526,7 +1516,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
/* X-Ray option */
uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
- xco + 10,yco - 68, 0.10 * (width-20), 19,
+ xco + 10, yco - 68, 0.10 * (width-20), 19,
&raySens->mode, 0.0, 0.0, 0, 0,
"Toggle X-Ray option (see through objects that don't have the property)");
/* 2. sensing range */
@@ -1610,8 +1600,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->flag, 0, 0, 0, 0,
"Triggered by all events on this joysticks current type (axis/button/hat)");
}
- if (joy->type == SENS_JOY_BUTTON)
- {
+ if (joy->type == SENS_JOY_BUTTON) {
if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
&joy->button, 0, 18, 100, 0,
@@ -1623,7 +1612,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->axis, 1, 8.0, 100, 0,
"Specify which axis pair to use, 1 is useually the main direction input");
- uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
+ uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20), yco-44, 0.4 * (width-20), 19,
&joy->precision, 0, 32768.0, 100, 0,
"Specify the precision of the axis");
@@ -1651,7 +1640,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->axis_single, 1, 16.0, 100, 0,
"Specify a single axis (verticle/horizontal/other) to detect");
- uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
+ uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20), yco-44, 0.4 * (width-20), 19,
&joy->precision, 0, 32768.0, 100, 0,
"Specify the precision of the axis");
}
@@ -1679,10 +1668,10 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
+ /* uiDefBut(block, LABEL, 1, "Not yet...", xco, yco-24, 80, 19, NULL, 0, 0, 0, 0, ""); */
ec= cont->data;
- /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
- uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
+ /* uiDefBut(block, BUT, 1, "Variables", xco, yco-24, 80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
+ uiDefBut(block, TEX, 1, "Exp:", xco + 10, yco-21, width-20, 19,
ec->str, 0, sizeof(ec->str), 0, 0,
"Expression");
@@ -1700,11 +1689,11 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
uiBlockBeginAlign(block);
- uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
+ uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4, yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
if (pc->mode==0)
- uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
+ uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70, yco-23, width-74, 19, &pc->text, "Blender textblock to run as a script");
else {
- uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
+ uiDefBut(block, TEX, 1, "", xco+70, yco-23, (width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
uiDefButBitI(block, TOG, CONT_PY_DEBUG, B_REDR, "D", (xco+width)-25, yco-23, 19, 19, &pc->flag, 0, 0, 0, 0, "Continuously reload the module from disk for editing external modules without restarting");
}
uiBlockEndAlign(block);
@@ -1727,7 +1716,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
static int get_col_actuator(int type)
{
- switch(type) {
+ switch (type) {
case ACT_ACTION: return TH_PANEL;
case ACT_SHAPEACTION: return TH_PANEL;
case ACT_OBJECT: return TH_PANEL;
@@ -1869,14 +1858,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
/* yco is at the top of the rect, draw downwards */
set_col_actuator(act->type, 0);
- switch (act->type)
- {
+ switch (act->type) {
case ACT_OBJECT:
{
oa = act->data;
wval = (width-100)/3;
- if (oa->type == ACT_OBJECT_NORMAL)
- {
+ if (oa->type == ACT_OBJECT_NORMAL) {
if (ob->gameflag & OB_DYNAMIC) {
ysize= 175;
}
@@ -1904,8 +1891,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButBitS(block, TOG, ACT_DLOC_LOCAL, 0, "L", xco+45+3*wval, yco-45, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
uiDefButBitS(block, TOG, ACT_DROT_LOCAL, 0, "L", xco+45+3*wval, yco-64, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- if ( ob->gameflag & OB_DYNAMIC )
- {
+ if (ob->gameflag & OB_DYNAMIC) {
uiDefBut(block, LABEL, 0, "Force", xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
@@ -1921,8 +1907,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiBlockEndAlign(block);
}
- if ( ob->gameflag & OB_DYNAMIC )
- {
+ if (ob->gameflag & OB_DYNAMIC) {
uiDefBut(block, LABEL, 0, "LinV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
@@ -1945,11 +1930,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-129, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
uiDefButBitS(block, TOG, ACT_ANG_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-148, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "use_additive",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
+ uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "use_additive", xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
}
}
- else if (oa->type == ACT_OBJECT_SERVO)
- {
+ else if (oa->type == ACT_OBJECT_SERVO) {
ysize= 195;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2030,22 +2014,22 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
if (aa->type == ACT_ACTION_FROM_PROP) {
- uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
+ uiDefBut(block, TEX, 0, "Prop: ", xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
}
else {
- uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
- uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
+ uiDefButF(block, NUM, 0, "Sta: ", xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
+ uiDefButF(block, NUM, 0, "End: ", xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
}
uiDefButS(block, NUM, 0, "Blendin: ", xco+10, yco-64, (width-20)/2, 19, &aa->blendin, 0.0, 32767, 0.0, 0.0, "Number of frames of motion blending");
uiDefButS(block, NUM, 0, "Priority: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, &aa->priority, 0.0, 100.0, 0.0, 0.0, "Execution priority - lower numbers will override actions with higher numbers, With 2 or more actions at once, the overriding channels must be lower in the stack");
- uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, MAX_NAME, 0, 0, "Assign the action's current frame number to this property");
+ uiDefBut(block, TEX, 0, "FrameProp: ", xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, MAX_NAME, 0, 0, "Assign the action's current frame number to this property");
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
if (aa->type == ACT_ACTION_MOTION) {
- uiDefButF(block, NUM, 0, "Cycle: ",xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
+ uiDefButF(block, NUM, 0, "Cycle: ", xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
}
#endif
@@ -2125,9 +2109,9 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
pa= act->data;
str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle (bool/int/float/timer)%x3";
- uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
+ uiDefButI(block, MENU, B_REDR, str, xco+30, yco-24, width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
- uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
+ uiDefBut(block, TEX, 1, "Prop: ", xco+30, yco-44, width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
if (pa->type==ACT_PROP_TOGGLE) {
@@ -2139,7 +2123,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, MAX_NAME, 0, 0, "Copy this property");
}
else {
- uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, MAX_NAME, 0, 0, "change with this value, use \"\" around strings");
+ uiDefBut(block, TEX, 1, "Value: ", xco+30, yco-64, width-60, 19, pa->value, 0, MAX_NAME, 0, 0, "change with this value, use \"\" around strings");
}
yco-= ysize;
@@ -2163,20 +2147,20 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr));
/* reset this value, it is for handling the event */
sa->sndnr = 0;
- uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10, yco-22, 20, 19, &(sa->sndnr), 0, 0, 0, 0, "");
uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19,
"Load a sound file (remember to set caching on for small sounds that are played often)");
if (sa->sound) {
char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|"
"Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
- uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19,
+ uiDefBut(block, TEX, B_IDNAME, "SO:", xco+30, yco-22, wval-20, 19,
((ID *)sa->sound)->name+2, 0.0, MAX_ID_NAME-2, 0, 0, "");
- uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19,
+ uiDefButS(block, MENU, 1, dummy_str, xco+10, yco-44, width-20, 19,
&sa->type, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume,
+ uiDefButF(block, NUM, 0, "Volume:", xco+10, yco-66, wval, 19, &sa->volume,
0.0, 1.0, 0, 0, "Sets the volume of this sound");
- uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->pitch,-12.0,
+ uiDefButF(block, NUM, 0, "Pitch:", xco+wval+10, yco-66, wval, 19, &sa->pitch, -12.0,
12.0, 0, 0, "Sets the pitch of this sound");
uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
&sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space");
@@ -2547,8 +2531,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
ysize = 48;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
-// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
+ uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44, width-20, 19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
+// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64, width-20, 19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
}
#if 0
else if (gma->type == ACT_GAME_START) {
@@ -2556,8 +2540,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
- uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
+ uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44, width-20, 19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
+ uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64, width-20, 19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
}
#endif
else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG)) {
@@ -2673,7 +2657,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
randAct = act->data;
/* 1. seed */
- uiDefButI(block, NUM, 1, "Seed: ", (xco+10),yco-24, 0.4 *(width-20), 19,
+ uiDefButI(block, NUM, 1, "Seed: ", (xco+10), yco-24, 0.4 *(width-20), 19,
&randAct->seed, 0, 1000, 0, 0,
"Initial seed of the random generator. Use Python for more freedom. "
" (Choose 0 for not random)");
@@ -2793,21 +2777,21 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
/* line 3: Text/Property */
uiDefButBitS(block, TOG, 1, B_REDR, "T/P",
- (xco+10),(yco-(myline*24)), (0.20 * (width-20)), 19,
+ (xco+10), (yco-(myline*24)), (0.20 * (width-20)), 19,
&ma->bodyType, 0.0, 0.0, 0, 0,
"Toggle message type: either Text or a PropertyName");
if (ma->bodyType == ACT_MESG_MESG) {
/* line 3: Message Body */
uiDefBut(block, TEX, 1, "Body: ",
- (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
+ (xco+10+(0.20*(width-20))), (yco-(myline++*24)), (0.8*(width-20)), 19,
&ma->body, 0, MAX_NAME, 0, 0,
"Optional message body Text");
}
else {
/* line 3: Property body (set by property) */
uiDefBut(block, TEX, 1, "Propname: ",
- (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
+ (xco+10+(0.20*(width-20))), (yco-(myline++*24)), (0.8*(width-20)), 19,
&ma->body, 0, MAX_NAME, 0, 0,
"The message body will be set by the Property Value");
}
@@ -2821,18 +2805,17 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
if (tdfa->type == ACT_2DFILTER_CUSTOMFILTER) {
ysize +=20;
}
- glRects( xco, yco-ysize, xco+width, yco );
- uiEmboss( (float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1 );
+ glRects(xco, yco-ysize, xco+width, yco);
+ uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- switch(tdfa->type)
- {
+ switch (tdfa->type) {
case ACT_2DFILTER_MOTIONBLUR:
if (!tdfa->flag) {
- uiDefButS(block, TOG, B_REDR, "D", xco+30,yco-44,19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
- uiDefButF(block, NUM, B_REDR, "Value:", xco+52,yco-44,width-82,19,&tdfa->float_arg,0.0,1.0,0.0,0.0,"Set motion blur value");
+ uiDefButS(block, TOG, B_REDR, "D", xco+30, yco-44, 19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
+ uiDefButF(block, NUM, B_REDR, "Value:", xco+52, yco-44, width-82, 19, &tdfa->float_arg, 0.0, 1.0, 0.0, 0.0, "Set motion blur value");
}
else {
- uiDefButS(block, TOG, B_REDR, "Disabled", xco+30,yco-44,width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
+ uiDefButS(block, TOG, B_REDR, "Disabled", xco+30, yco-44, width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
}
break;
case ACT_2DFILTER_BLUR:
@@ -2848,18 +2831,18 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
case ACT_2DFILTER_NOFILTER:
case ACT_2DFILTER_DISABLED:
case ACT_2DFILTER_ENABLED:
- uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set filter order");
+ uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30, yco-44, width-60, 19, &tdfa->int_arg, 0.0, MAX_RENDER_PASS-1, 0.0, 0.0, "Set filter order");
break;
case ACT_2DFILTER_CUSTOMFILTER:
- uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set filter order");
- uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30,yco-64,width-60, 19, &tdfa->text, "");
+ uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30, yco-44, width-60, 19, &tdfa->int_arg, 0.0, MAX_RENDER_PASS-1, 0.0, 0.0, "Set filter order");
+ uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30, yco-64, width-60, 19, &tdfa->text, "");
break;
}
str= "2D Filter %t|Motion Blur %x1|Blur %x2|Sharpen %x3|Dilation %x4|Erosion %x5|"
"Laplacian %x6|Sobel %x7|Prewitt %x8|Gray Scale %x9|Sepia %x10|Invert %x11|Custom Filter %x12|"
"Enable Filter %x-2|Disable Filter %x-1|Remove Filter %x0|";
- uiDefButS(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
+ uiDefButS(block, MENU, B_REDR, str, xco+30, yco-24, width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
yco -= ysize;
break;
@@ -2929,7 +2912,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
ysize += 40;
break;
case ACT_ARM_SETWEIGHT:
- uiDefButF(block, NUM, B_REDR, "Weight:", xco+5+(width-10)*0.35,yco-24,(width-10)*0.65,19,&armAct->weight,0.0,1.0,0.0,0.0,"Set weight of this constraint");
+ uiDefButF(block, NUM, B_REDR, "Weight:", xco+5+(width-10)*0.35, yco-24, (width-10)*0.65, 19, &armAct->weight, 0.0, 1.0, 0.0, 0.0, "Set weight of this constraint");
break;
}
}
@@ -3041,7 +3024,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
uiBlockSetButmFunc(block, do_controller_menu, NULL);
uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, 1, "Hide Objects", 0,(short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefBut(block, SEPR, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefBut(block, BUTM, 1, "Show Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
uiDefBut(block, BUTM, 1, "Hide Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
@@ -3759,8 +3742,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_ARM_RUN:
break;
case ACT_ARM_ENABLE:
@@ -3835,8 +3817,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_CONST_TYPE_LOC:
uiItemR(layout, ptr, "limit", 0, NULL, ICON_NONE);
@@ -3865,7 +3846,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance")==1);
uiItemR(sub, ptr, "distance", 0, "", ICON_NONE);
- uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
+ uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
split = uiLayoutSplit(layout, 0.15, 0);
uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -3886,7 +3867,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
uiItemR(layout, ptr, "direction_axis_pos", 0, NULL, ICON_NONE);
row=uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
+ uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
row=uiLayoutRow(layout, 0);
@@ -3900,16 +3881,16 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
case ACT_CONST_TYPE_FH:
split=uiLayoutSplit(layout, 0.75, 0);
row= uiLayoutRow(split, 0);
- uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
+ uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, ICON_NONE);
+ uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NONE);
split = uiLayoutSplit(row, 0.9, 0);
uiItemR(split, ptr, "fh_force", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE , NULL, ICON_NONE);
+ uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
split = uiLayoutSplit(layout, 0.15, 0);
uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -3934,8 +3915,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *split, *sub;
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_EDOB_ADD_OBJECT:
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
@@ -3988,8 +3968,7 @@ static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *split;
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_2DFILTER_CUSTOMFILTER:
uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NONE);
@@ -4163,8 +4142,7 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
- switch(RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_PROP_TOGGLE:
break;
case ACT_PROP_ADD:
@@ -4571,7 +4549,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
row = uiLayoutRow(split, 1);
- uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
+ uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NONE);
@@ -4666,7 +4644,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
row = uiLayoutRow(layout, 1);
- uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+ uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NONE);
@@ -4732,7 +4710,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
row = uiLayoutRow(layout, 1);
- uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
+ uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NONE);
@@ -4861,9 +4839,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if (ob->controllers.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
+ uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
// if (ob->controllers.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
+ uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add", (short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
uiBlockEndAlign(block);
yco-=20;
@@ -4900,9 +4878,9 @@ void logic_buttons(bContext *C, ARegion *ar)
}
}
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_ALLSTATE, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
- uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
- uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
+ uiDefButBitS(block, TOG, OB_ALLSTATE, B_SET_STATE_BIT, "All", (short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
+ uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini", (short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
+ uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D", (short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
uiBlockEndAlign(block);
yco-=35;
@@ -4935,7 +4913,7 @@ void logic_buttons(bContext *C, ARegion *ar)
if (cont->flag & CONT_SHOW) {
cont->otype= cont->type;
- uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
+ uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(), (short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
but = uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
@@ -4945,10 +4923,10 @@ void logic_buttons(bContext *C, ARegion *ar)
}
else {
cpack(0x999999);
- glRecti(xco+22, yco, xco+width-22,yco+19);
+ glRecti(xco+22, yco, xco+width-22, yco+19);
but = uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
- but = uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
+ but = uiDefBut(block, LABEL, 0, cont->name, (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
uiBlockBeginAlign(block);
@@ -4964,7 +4942,7 @@ void logic_buttons(bContext *C, ARegion *ar)
but = uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
+ uiDefIconBut(block, INLINK, 0, ICON_INLINK, (short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
/* offset is >0 if at least one controller was displayed */
offset++;
yco-=20;
@@ -4999,9 +4977,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if (ob->sensors.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+ uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
// if (ob->sensors.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
+ uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add", (short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
uiBlockEndAlign(block);
yco-=20;
@@ -5036,7 +5014,7 @@ void logic_buttons(bContext *C, ARegion *ar)
}
else {
set_col_sensor(sens->type, 1);
- glRecti(xco+22, yco, xco+width-22,yco+19);
+ glRecti(xco + 22, yco, xco + width - 22, yco + 19);
but = uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
but = uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
@@ -5079,9 +5057,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if (ob->actuators.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
+ uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
// if (ob->actuators.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
+ uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add", (short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
uiBlockEndAlign(block);
yco-=20;
@@ -5114,7 +5092,7 @@ void logic_buttons(bContext *C, ARegion *ar)
}
else {
set_col_actuator(act->type, 1);
- glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
+ glRecti((short)(xco+22), yco, (short)(xco+width-22), (short)(yco+19));
/* but= */ uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type");
// uiButSetFunc(but, old_sca_move_actuator, act, NULL);
/* but= */ uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name");
@@ -5130,7 +5108,7 @@ void logic_buttons(bContext *C, ARegion *ar)
ycoo= yco;
}
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
+ uiDefIconBut(block, INLINK, 0, ICON_INLINK, (short)(xco - 19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
yco-=20;
}
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 82175f83d39..93105c39f39 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -195,12 +195,12 @@ static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
static void logic_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_LOGIC:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_FRAME:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index de42e4a783d..a133d370d99 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -76,7 +76,7 @@ static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event)
{
//Scene *scene= CTX_data_scene(C);
- switch(event) {
+ switch (event) {
}
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 1d323cb6a4f..c8f9c66d24b 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -211,7 +211,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
/* offset for start of channel (on LHS of channel-list) */
if (ale->id) {
/* special exception for materials and particles */
- if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
+ if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
offset= 21 + NLACHANNEL_BUTTON_WIDTH;
else
offset= 14;
@@ -341,7 +341,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
return OPERATOR_FINISHED;
}
-void NLA_OT_channels_click (wmOperatorType *ot)
+void NLA_OT_channels_click(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Click on NLA Channels";
@@ -415,7 +415,7 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_tracks_add (wmOperatorType *ot)
+void NLA_OT_tracks_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Track(s)";
@@ -479,7 +479,7 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_delete_tracks (wmOperatorType *ot)
+void NLA_OT_delete_tracks(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Tracks";
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 7ed49025814..d331415bc46 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -534,7 +534,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
/* ---------------------- */
-void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -920,7 +920,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
}
}
-void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar)
+void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 1a94b1160be..994021db9ff 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -76,7 +76,7 @@
/* Utilities exported to other places... */
/* Perform validation for blending/extend settings */
-void ED_nla_postop_refresh (bAnimContext *ac)
+void ED_nla_postop_refresh(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -155,7 +155,7 @@ static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_tweakmode_enter (wmOperatorType *ot)
+void NLA_OT_tweakmode_enter(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Enter Tweak Mode";
@@ -220,7 +220,7 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_tweakmode_exit (wmOperatorType *ot)
+void NLA_OT_tweakmode_exit(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Exit Tweak Mode";
@@ -335,7 +335,7 @@ static int nlaedit_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
return nlaedit_viewall(C, TRUE);
}
-void NLA_OT_view_all (wmOperatorType *ot)
+void NLA_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View All";
@@ -350,7 +350,7 @@ void NLA_OT_view_all (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void NLA_OT_view_selected (wmOperatorType *ot)
+void NLA_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View Selected";
@@ -468,7 +468,7 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_actionclip_add (wmOperatorType *ot)
+void NLA_OT_actionclip_add(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -595,7 +595,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
}
}
-void NLA_OT_transition_add (wmOperatorType *ot)
+void NLA_OT_transition_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Transition";
@@ -680,7 +680,7 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_soundclip_add (wmOperatorType *ot)
+void NLA_OT_soundclip_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Sound Clip";
@@ -742,7 +742,7 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_meta_add (wmOperatorType *ot)
+void NLA_OT_meta_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Meta-Strips";
@@ -794,7 +794,7 @@ static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_meta_remove (wmOperatorType *ot)
+void NLA_OT_meta_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Meta-Strips";
@@ -897,7 +897,7 @@ static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
return OPERATOR_FINISHED;
}
-void NLA_OT_duplicate (wmOperatorType *ot)
+void NLA_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Strips";
@@ -972,7 +972,7 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_delete (wmOperatorType *ot)
+void NLA_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Strips";
@@ -1117,7 +1117,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_split (wmOperatorType *ot)
+void NLA_OT_split(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Split Strips";
@@ -1170,7 +1170,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_bake (wmOperatorType *ot)
+void NLA_OT_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Strips";
@@ -1232,7 +1232,7 @@ static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_mute_toggle (wmOperatorType *ot)
+void NLA_OT_mute_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Toggle Muting";
@@ -1389,7 +1389,7 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_swap (wmOperatorType *ot)
+void NLA_OT_swap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Swap Strips";
@@ -1463,7 +1463,7 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_move_up (wmOperatorType *ot)
+void NLA_OT_move_up(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Strips Up";
@@ -1537,7 +1537,7 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_move_down (wmOperatorType *ot)
+void NLA_OT_move_down(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Strips Down";
@@ -1613,7 +1613,7 @@ static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_action_sync_length (wmOperatorType *ot)
+void NLA_OT_action_sync_length(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sync Action Length";
@@ -1713,7 +1713,7 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_apply_scale (wmOperatorType *ot)
+void NLA_OT_apply_scale(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Scale";
@@ -1776,7 +1776,7 @@ static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_clear_scale (wmOperatorType *ot)
+void NLA_OT_clear_scale(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Scale";
@@ -1917,7 +1917,7 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_snap (wmOperatorType *ot)
+void NLA_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Strips";
@@ -2036,7 +2036,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_fmodifier_add (wmOperatorType *ot)
+void NLA_OT_fmodifier_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add F-Modifier";
@@ -2100,7 +2100,7 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_fmodifier_copy (wmOperatorType *ot)
+void NLA_OT_fmodifier_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy F-Modifiers";
@@ -2162,7 +2162,7 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
}
}
-void NLA_OT_fmodifier_paste (wmOperatorType *ot)
+void NLA_OT_fmodifier_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste F-Modifiers";
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 78fb92f2ee4..b320adc25fb 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -58,7 +58,7 @@
/* ************************** poll callbacks for operators **********************************/
/* tweakmode is NOT enabled */
-int nlaop_poll_tweakmode_off (bContext *C)
+int nlaop_poll_tweakmode_off(bContext *C)
{
Scene *scene;
@@ -80,7 +80,7 @@ int nlaop_poll_tweakmode_off (bContext *C)
}
/* tweakmode IS enabled */
-int nlaop_poll_tweakmode_on (bContext *C)
+int nlaop_poll_tweakmode_on(bContext *C)
{
Scene *scene;
@@ -102,7 +102,7 @@ int nlaop_poll_tweakmode_on (bContext *C)
}
/* is tweakmode enabled - for use in NLA operator code */
-short nlaedit_is_tweakmode_on (bAnimContext *ac)
+short nlaedit_is_tweakmode_on(bAnimContext *ac)
{
if (ac && ac->scene)
return (ac->scene->flag & SCE_NLA_EDIT_ON);
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index b0cd59ea7ad..cfd4a3202d2 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -183,7 +183,7 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_select_all_toggle (wmOperatorType *ot)
+void NLA_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "(De)select All";
@@ -254,8 +254,8 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
/* only select strips if they fall within the required ranges (if applicable) */
for (strip= nlt->strips.first; strip; strip= strip->next) {
- if ( (mode == NLA_BORDERSEL_CHANNELS) ||
- BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax) )
+ if ( (mode == NLA_BORDERSEL_CHANNELS) ||
+ BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax))
{
/* set selection */
ACHANNEL_SET_FLAG(strip, selectmode, NLASTRIP_FLAG_SELECT);
@@ -481,7 +481,7 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
return nlaedit_select_leftright_exec(C, op);
}
-void NLA_OT_select_leftright (wmOperatorType *ot)
+void NLA_OT_select_leftright(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Left/Right";
@@ -643,7 +643,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
-void NLA_OT_click_select (wmOperatorType *ot)
+void NLA_OT_click_select(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Select";
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 4dc3aef7d2c..27c48d2232f 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -348,12 +348,12 @@ static void nla_buttons_area_draw(const bContext *C, ARegion *ar)
static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_FRAME:
case ND_MARKERS:
@@ -362,7 +362,7 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -381,12 +381,12 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
@@ -396,7 +396,7 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -406,7 +406,7 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_EDITED:
ED_region_tag_redraw(ar);
break;
@@ -425,19 +425,19 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
ED_region_tag_redraw(ar);
break;
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 42aea32b7f6..bd17c821567 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -266,7 +266,7 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
/* 16 values of sin function */
static float si[16] = {
- 0.00000000f, 0.39435585f,0.72479278f,0.93775213f,
+ 0.00000000f, 0.39435585f, 0.72479278f,0.93775213f,
0.99871650f,0.89780453f,0.65137248f,0.29936312f,
-0.10116832f,-0.48530196f,-0.79077573f,-0.96807711f,
-0.98846832f,-0.84864425f,-0.57126821f,-0.20129852f
@@ -289,12 +289,12 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
glColor4ub(0, 0, 0, 150);
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_LOOP);
for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
#endif
@@ -442,7 +442,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
nodeSetActive(ntree, node);
if ( ntree->type == NTREE_TEXTURE )
- ntreeTexCheckCyclics( ntree );
+ ntreeTexCheckCyclics(ntree);
// allqueue(REDRAWBUTSSHADING, 0);
// allqueue(REDRAWNODE, 0);
@@ -870,16 +870,16 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* group node outline */
uiSetRoundBox(UI_CNR_ALL);
glColor4ub(200, 200, 200, 140);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
uiDrawBox(GL_LINE_LOOP, rect.xmin-node_group_frame, rect.ymin, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
/* backdrop title */
UI_ThemeColor(TH_TEXT_HI);
layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (short)(rect.xmin+15), (short)(rect.ymax+group_header),
- MIN2((int)(rect.xmax - rect.xmin-18.0f), node_group_frame+20), group_header, UI_GetStyle());
+ MIN2((int)(rect.xmax - rect.xmin-18.0f), node_group_frame+20), group_header, UI_GetStyle());
RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
uiTemplateIDBrowse(layout, (bContext*)C, &ptr, "node_tree", NULL, NULL, NULL);
uiBlockLayoutResolve(gnode->block, NULL, NULL);
@@ -963,7 +963,7 @@ static void node_update_frame(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree
static void node_common_set_butfunc(bNodeType *ntype)
{
- switch(ntype->type) {
+ switch (ntype->type) {
case NODE_GROUP:
ntype->uifunc= node_uifunc_group;
ntype->drawfunc= node_draw_group;
@@ -1176,7 +1176,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
static void node_shader_set_butfunc(bNodeType *ntype)
{
ntype->uifuncbut = NULL;
- switch(ntype->type) {
+ switch (ntype->type) {
/* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
case SH_NODE_MATERIAL:
@@ -1635,9 +1635,14 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C),
static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- uiLayout *col;
+ uiLayout *col, *row;
col = uiLayoutColumn(layout, 1);
+
+ uiItemL(layout, "Color Space:", ICON_NONE);
+ row= uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
@@ -1647,7 +1652,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
uiLayout *row, *col;
uiItemL(layout, "Despill Channel:", ICON_NONE);
- row = uiLayoutRow(layout,0);
+ row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
col= uiLayoutColumn(layout, 0);
@@ -1655,7 +1660,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
if (RNA_enum_get(ptr, "limit_method")==0) {
uiItemL(col, "Limiting Channel:", ICON_NONE);
- row=uiLayoutRow(col,0);
+ row=uiLayoutRow(col, 0);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1710,7 +1715,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "limit_method")==0) {
uiItemL(col, "Limiting Channel:", ICON_NONE);
- row=uiLayoutRow(col,0);
+ row=uiLayoutRow(col, 0);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1941,7 +1946,7 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po
static void node_composit_set_butfunc(bNodeType *ntype)
{
ntype->uifuncbut = NULL;
- switch(ntype->type) {
+ switch (ntype->type) {
/* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
case CMP_NODE_IMAGE:
@@ -2137,7 +2142,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
col= uiLayoutColumn(layout, 0);
- switch( tex->type ) {
+ switch ( tex->type ) {
case TEX_BLEND:
uiItemR(col, &tex_ptr, "progression", 0, "", ICON_NONE);
row= uiLayoutRow(col, 0);
@@ -2222,45 +2227,50 @@ static void node_texture_set_butfunc(bNodeType *ntype)
if ( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
ntype->uifunc = node_texture_buts_proc;
}
- else switch(ntype->type) {
-
+ else {
+ switch (ntype->type) {
+
case TEX_NODE_MATH:
ntype->uifunc = node_buts_math;
break;
-
+
case TEX_NODE_MIX_RGB:
ntype->uifunc = node_buts_mix_rgb;
break;
-
+
case TEX_NODE_VALTORGB:
ntype->uifunc = node_buts_colorramp;
break;
-
+
case TEX_NODE_CURVE_RGB:
ntype->uifunc= node_buts_curvecol;
break;
-
+
case TEX_NODE_CURVE_TIME:
ntype->uifunc = node_buts_time;
break;
-
+
case TEX_NODE_TEXTURE:
ntype->uifunc = node_buts_texture;
break;
-
+
case TEX_NODE_BRICKS:
ntype->uifunc = node_texture_buts_bricks;
break;
-
+
case TEX_NODE_IMAGE:
ntype->uifunc = node_texture_buts_image;
break;
-
+
case TEX_NODE_OUTPUT:
ntype->uifunc = node_texture_buts_output;
break;
+ }
+ }
+
+ if (ntype->uifuncbut == NULL) {
+ ntype->uifuncbut = ntype->uifunc;
}
- if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
}
/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
@@ -2305,7 +2315,7 @@ void ED_init_node_butfuncs(void)
for (i=0; i < NUM_SOCKET_TYPES; ++i) {
stype = ntreeGetSocketType(i);
if (stype) {
- switch(stype->type) {
+ switch (stype->type) {
case SOCK_FLOAT:
case SOCK_INT:
case SOCK_BOOLEAN:
@@ -2494,8 +2504,8 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
else {
/* always do all three, to prevent data hanging around */
- forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float)*2);
- forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, sizeof(float)*2);
+ BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float)*2);
+ BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, sizeof(float)*2);
return 1;
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 040f921b6ac..7cddaa5e0e7 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -459,17 +459,17 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
{
/* 16 values of sin function */
static float si[16] = {
- 0.00000000f, 0.39435585f,0.72479278f,0.93775213f,
- 0.99871650f,0.89780453f,0.65137248f,0.29936312f,
- -0.10116832f,-0.48530196f,-0.79077573f,-0.96807711f,
- -0.98846832f,-0.84864425f,-0.57126821f,-0.20129852f
+ 0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
+ 0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
+ -0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
+ -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
};
/* 16 values of cos function */
static float co[16] ={
- 1.00000000f,0.91895781f,0.68896691f,0.34730525f,
- -0.05064916f,-0.44039415f,-0.75875812f,-0.95413925f,
- -0.99486932f,-0.87434661f,-0.61210598f,-0.25065253f,
- 0.15142777f,0.52896401f,0.82076344f,0.97952994f,
+ 1.00000000f, 0.91895781f, 0.68896691f, 0.34730525f,
+ -0.05064916f, -0.44039415f, -0.75875812f, -0.95413925f,
+ -0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
+ 0.15142777f, 0.52896401f, 0.82076344f, 0.97952994f,
};
int a;
@@ -488,12 +488,12 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
glColor4ub(0, 0, 0, 150);
}
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_LOOP);
for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glLineWidth(1.0f);
}
@@ -547,7 +547,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
glPixelZoom(xscale, yscale);
glEnable(GL_BLEND);
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); /* premul graphics */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* premul graphics */
glColor4f(1.0, 1.0, 1.0, 1.0);
glaDrawPixelsTex(prv->xmin, prv->ymin, preview->xsize, preview->ysize, GL_UNSIGNED_BYTE, preview->rect);
@@ -691,7 +691,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* outline active and selected emphasis */
if ( node->flag & (NODE_ACTIVE|SELECT) ) {
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
if ( node->flag & NODE_ACTIVE )
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
@@ -700,7 +700,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); // round all corners except lower right
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -786,14 +786,14 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* outline active and selected emphasis */
if ( node->flag & (NODE_ACTIVE|SELECT) ) {
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
if ( node->flag & NODE_ACTIVE )
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
else
UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -939,7 +939,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
//uiFreeBlocksWin(&sa->uiblocks, sa->win);
/* only set once */
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_MAP1_VERTEX_3);
/* aspect+font, set each time */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index dda06267237..f38e3e0d272 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -284,7 +284,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
ntree= ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_MA: {
Material *ma= (Material*)id;
ma->nodetree = ntree;
@@ -1458,7 +1458,7 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int sample_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- switch(event->type) {
+ switch (event->type) {
case LEFTMOUSE:
case RIGHTMOUSE: // XXX hardcoded
sample_exit(C, op);
@@ -2651,7 +2651,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
float mcoords[256][2];
int i= 0;
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 4df60e6eede..a540f18b3a5 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -517,7 +517,7 @@ static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
- return node_select_exec(C,op);
+ return node_select_exec(C, op);
}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 049886b1d66..13e85c7f74d 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -220,8 +220,10 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
/* also preserve mapping for texture nodes */
if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
- node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
+ node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
+ {
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
+ }
/* remove node */
node_remove_linked(ntree, node_prev);
@@ -295,11 +297,14 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
BLI_strncpy(node_name, node->typeinfo->name, UI_MAX_NAME_STR);
if (node->inputs.first == NULL &&
- node->outputs.first != node->outputs.last &&
- !(node->typeinfo->flag & NODE_OPTIONS))
+ node->outputs.first != node->outputs.last &&
+ !(node->typeinfo->flag & NODE_OPTIONS))
+ {
BLI_snprintf(name, UI_MAX_NAME_STR, "%s | %s", node_name, sock->link->fromsock->name);
- else
+ }
+ else {
BLI_strncpy(name, node_name, UI_MAX_NAME_STR);
+ }
}
else if (sock->type == SOCK_SHADER)
BLI_strncpy(name, "None", UI_MAX_NAME_STR);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index fca9927b0f5..3540c20e515 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -172,7 +172,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
short shader_type = snode->shaderfrom;
/* preview renders */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
switch (wmn->data) {
case ND_NODES:
@@ -244,7 +244,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case NC_SCREEN:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_ANIMPLAY:
ED_area_tag_refresh(sa);
break;
@@ -429,7 +429,7 @@ static void node_header_area_draw(const bContext *C, ARegion *ar)
static void node_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
if (wmn->data==ND_SPACE_NODE)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 779475943dd..042b668c9cc 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -77,7 +77,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
TreeElement *te= lb->first;
while (te) {
TreeStoreElem *tselem= TREESTORE(te);
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_height(soops, &te->subtree, h);
(*h) += UI_UNIT_Y;
te= te->next;
@@ -92,7 +92,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
// TreeStoreElem *tselem= TREESTORE(te);
// XXX fixme... te->xend is not set yet
- if (!TSELEM_OPEN(tselem,soops)) {
+ if (!TSELEM_OPEN(tselem, soops)) {
if (te->xend > *w)
*w = te->xend;
}
@@ -117,7 +117,7 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start
if (startx+100 > *w)
*w = startx+100;
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
te= te->next;
}
@@ -278,7 +278,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
if (tselem->type==0) {
test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort
- switch(GS(tselem->id->name)) {
+ switch (GS(tselem->id->name)) {
case ID_MA:
WM_event_add_notifier(C, NC_MATERIAL, NULL); break;
case ID_TE:
@@ -305,7 +305,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
}
}
else {
- switch(tselem->type) {
+ switch (tselem->type) {
case TSE_DEFGROUP:
defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
break;
@@ -505,7 +505,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
}
}
@@ -546,7 +546,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
ptr= &te->rnaptr;
prop= te->directdata;
- if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
+ if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem, soops))) )
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
}
else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
@@ -557,7 +557,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
}
}
@@ -719,7 +719,7 @@ static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
short maptype= keymap_menu_type(kmi->type);
if (maptype!=kmi->maptype) {
- switch(kmi->maptype) {
+ switch (kmi->maptype) {
case OL_KM_KEYBOARD:
kmi->type= AKEY;
kmi->val= KM_PRESS;
@@ -776,14 +776,14 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
xstart+= butw2+5;
/* edit actual event */
- switch(kmi->maptype) {
+ switch (kmi->maptype) {
case OL_KM_KEYBOARD:
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, "Key code");
xstart+= butw2+5;
break;
case OL_KM_MOUSE:
str= keymap_mouse_menu();
- uiDefButS(block, MENU, 0, str, xstart,(int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Mouse button");
+ uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Mouse button");
xstart+= butw2+5;
break;
case OL_KM_TWEAK:
@@ -814,7 +814,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
}
}
@@ -857,7 +857,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
}
}
@@ -904,7 +904,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
arg.alpha= alpha;
if (tselem->type) {
- switch( tselem->type) {
+ switch ( tselem->type) {
case TSE_ANIM_DATA:
UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx
case TSE_NLA:
@@ -932,7 +932,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
{
Object *ob= (Object *)tselem->id;
ModifierData *md= BLI_findlink(&ob->modifiers, tselem->nr);
- switch(md->type) {
+ switch (md->type) {
case eModifierType_Subsurf:
UI_icon_draw(x, y, ICON_MOD_SUBSURF); break;
case eModifierType_Armature:
@@ -1093,7 +1093,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
}
}
else {
- switch( GS(tselem->id->name)) {
+ switch ( GS(tselem->id->name)) {
case ID_SCE:
tselem_draw_icon_uibut(&arg, ICON_SCENE_DATA); break;
case ID_ME:
@@ -1108,7 +1108,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
{
Lamp *la= (Lamp *)tselem->id;
- switch(la->type) {
+ switch (la->type) {
case LA_LOCAL:
tselem_draw_icon_uibut(&arg, ICON_LAMP_POINT); break;
case LA_SUN:
@@ -1185,7 +1185,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
uiSetRoundBox(UI_CNR_ALL);
glColor4ub(255, 255, 255, 100);
- uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
+ uiRoundBox((float) * offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables */
}
@@ -1317,7 +1317,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
/* active circle */
if (active) {
uiSetRoundBox(UI_CNR_ALL);
- uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
+ uiRoundBox((float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables it */
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
@@ -1332,7 +1332,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
icon_x = startx+5*ufac;
// icons a bit higher
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN);
else
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
@@ -1371,7 +1371,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
- if (!TSELEM_OPEN(tselem,soops)) {
+ if (!TSELEM_OPEN(tselem, soops)) {
if (te->subtree.first) {
if (tselem->type==0 && te->idcode==ID_SCE);
else if (tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */
@@ -1397,7 +1397,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
te->ys= (float)*starty;
te->xend= startx+offsx;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
*starty-= UI_UNIT_Y;
for (ten= te->subtree.first; ten; ten= ten->next)
@@ -1430,7 +1430,7 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty);
}
@@ -1454,12 +1454,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
tselem= TREESTORE(te);
/* selection status */
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
if (tselem->type == TSE_RNA_STRUCT)
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1);
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
if (tselem->type == TSE_RNA_STRUCT)
fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y);
@@ -1480,7 +1480,7 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
}
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 62d93f62d0f..7b200e9593d 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -652,7 +652,7 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te,
te->ys= (float)(*starty);
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
TreeElement *ten;
for (ten= te->subtree.first; ten; ten= ten->next) {
outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty);
@@ -875,7 +875,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
}
else tselem->flag |= TSE_CLOSED;
- if (TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
}
}
@@ -1140,7 +1140,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
do_outliner_drivers_editop(soops, &te->subtree, reports, mode);
}
}
@@ -1308,7 +1308,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
do_outliner_keyingset_editop(soops, ks, &te->subtree, mode);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index c06576e48a6..00b3979b074 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -99,7 +99,7 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
change |= 1;
}
}
- else if (TSELEM_OPEN(tselem,soops)) {
+ else if (TSELEM_OPEN(tselem, soops)) {
/* Only try selecting sub-elements if we haven't hit the right element yet
*
* Hack warning:
@@ -629,7 +629,7 @@ static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te,
int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
- switch(te->idcode) {
+ switch (te->idcode) {
/* Note: no ID_OB: objects are handled specially to allow multiple
* selection. See do_outliner_item_activate. */
case ID_MA:
@@ -652,7 +652,7 @@ int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement
/* Context can be NULL when set==0 */
int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set)
{
- switch(tselem->type) {
+ switch (tselem->type) {
case TSE_DEFGROUP:
return tree_element_active_defgroup(C, scene, te, tselem, set);
case TSE_BONE:
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 5c527face83..89eb51f73ba 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -96,7 +96,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
else {
int idcode= GS(tselem->id->name);
- switch(idcode) {
+ switch (idcode) {
case ID_SCE:
*scenelevel= 1;
break;
@@ -115,9 +115,9 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
set_operation_types(soops, &te->subtree,
- scenelevel, objectlevel, idlevel, datalevel);
+ scenelevel, objectlevel, idlevel, datalevel);
}
}
}
@@ -230,7 +230,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
operation_cb(C, scene, te, tsep, tselem);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb);
}
}
@@ -356,7 +356,7 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
}
else {
/* link to scene */
- base= MEM_callocN( sizeof(Base), "add_base");
+ base= MEM_callocN(sizeof(Base), "add_base");
BLI_addhead(&scene->base, base);
base->lay= (1<<20)-1; /*v3d->lay;*/ /* would be nice to use the 3d layer but the include's not here */
gob->ob->flag |= SELECT;
@@ -388,7 +388,7 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop
operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
}
}
@@ -495,7 +495,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
operation_cb(event, te, tselem);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
}
}
@@ -870,7 +870,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
operation_cb(te, tselem, tsep, newid);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_id_set_operation(soops, type, &te->subtree, newid, operation_cb);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index e2d43386c5e..026132e1f16 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -538,7 +538,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
int index;
temod->name = "Modifiers";
- for (index=0,md=ob->modifiers.first; md; index++,md=md->next) {
+ for (index=0, md=ob->modifiers.first; md; index++, md=md->next) {
TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index);
te->name= md->name;
te->directdata = md;
@@ -956,7 +956,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->name= RNA_struct_ui_name(ptr->type);
/* If searching don't expand RNA entries */
- if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+ if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
iterprop= RNA_struct_iterator_property(ptr->type);
tot= RNA_property_collection_length(ptr, iterprop);
@@ -966,7 +966,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
if (!tselem->used)
tselem->flag &= ~TSE_CLOSED;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a);
}
@@ -988,13 +988,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->rnaptr= *ptr;
/* If searching don't expand RNA entries */
- if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+ if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
if (proptype == PROP_POINTER) {
pptr= RNA_property_pointer_get(ptr, prop);
if (pptr.data) {
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1);
else
te->flag |= TE_LAZY_CLOSED;
@@ -1003,7 +1003,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if (proptype == PROP_COLLECTION) {
tot= RNA_property_collection_length(ptr, prop);
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (a=0; a<tot; a++) {
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a);
@@ -1015,7 +1015,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if (ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
tot= RNA_property_array_length(ptr, prop);
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a);
}
@@ -1048,7 +1048,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->directdata= idv;
te->name= km->idname;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
a= 0;
for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
@@ -1351,7 +1351,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
/* flag as not a found item */
tselem->flag &= ~TSE_SEARCHMATCH;
- if ((!TSELEM_OPEN(tselem,soops)) || outliner_filter_tree(soops, &te->subtree)==0) {
+ if ((!TSELEM_OPEN(tselem, soops)) || outliner_filter_tree(soops, &te->subtree)==0) {
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index ed050b7f93d..c2a3affa1b6 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -182,9 +182,9 @@ static void outliner_main_area_free(ARegion *UNUSED(ar))
static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_OB_SELECT:
case ND_OB_VISIBLE:
@@ -200,7 +200,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_TRANSFORM:
/* transform doesn't change outliner data */
break;
@@ -212,7 +212,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case ND_CONSTRAINT:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_ADDED:
case NA_REMOVED:
case NA_RENAME:
@@ -244,7 +244,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_MATERIAL:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SHADING:
case ND_SHADING_DRAW:
ED_region_tag_redraw(ar);
@@ -255,7 +255,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_GEOM:
- switch(wmn->data) {
+ 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);
@@ -263,7 +263,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ANIMATION:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_NLA_ACTCHANGE:
case ND_KEYFRAME:
ED_region_tag_redraw(ar);
@@ -299,7 +299,7 @@ static void outliner_header_area_free(ARegion *UNUSED(ar))
static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
if (wmn->data == ND_KEYINGSET)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index dfa733deac6..09d974fe4b8 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -188,7 +188,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
else if (RNA_struct_find_property(op->ptr, "files")) {
/* used for image strip */
/* best guess, first images name */
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(seq_load->name, name, sizeof(seq_load->name));
MEM_freeN(name);
@@ -420,8 +420,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only));
- RNA_BEGIN(op->ptr, itemptr, "files")
- {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
RNA_string_get(&itemptr, "name", file_only);
BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
@@ -595,7 +594,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
strip = seq->strip;
se = strip->stripdata;
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(se->name, filename, sizeof(se->name));
MEM_freeN(filename);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index cd0c8779c39..38a5151590e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -206,14 +206,12 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
length = floor((waveform->length - startsample) / samplestep);
glBegin(GL_LINE_STRIP);
- for (i = 0; i < length; i++)
- {
+ for (i = 0; i < length; i++) {
pos = startsample + i * samplestep;
value = waveform->data[pos * 3];
- for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
- {
+ for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
if (value > waveform->data[j * 3])
value = waveform->data[j * 3];
}
@@ -223,14 +221,12 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
glEnd();
glBegin(GL_LINE_STRIP);
- for (i = 0; i < length; i++)
- {
+ for (i = 0; i < length; i++) {
pos = startsample + i * samplestep;
value = waveform->data[pos * 3 + 1];
- for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
- {
+ for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
if (value < waveform->data[j * 3 + 1])
value = waveform->data[j * 3 + 1];
}
@@ -930,7 +926,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
}
- glEnd( );
+ glEnd();
glBindTexture(GL_TEXTURE_2D, last_texid);
glDisable(GL_TEXTURE_2D);
glDeleteTextures(1, &texid);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bd306f2d646..d2b1cccfefc 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -87,7 +87,6 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", "Gamma Cross effect strip type"},
{SEQ_MUL, "MULTIPLY", 0, "Multiply", "Multiply effect strip type"},
{SEQ_OVERDROP, "OVER_DROP", 0, "Alpha Over Drop", "Alpha Over Drop effect strip type"},
- {SEQ_PLUGIN, "PLUGIN", 0, "Plugin", "Plugin effect strip type"},
{SEQ_WIPE, "WIPE", 0, "Wipe", "Wipe effect strip type"},
{SEQ_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"},
{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"},
@@ -202,7 +201,7 @@ static void seq_proxy_build_job(const bContext *C)
WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
}
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if ((seq->flag & SELECT)) {
context = seq_proxy_rebuild_context(pj->main, pj->scene, seq);
link = BLI_genericNodeN(context);
@@ -462,8 +461,7 @@ void deselect_all_seq(Scene *scene)
if (ed == NULL) return;
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
seq->flag &= ~SEQ_ALLSEL;
}
SEQ_END
@@ -846,7 +844,7 @@ static int insert_gap(Scene *scene, int gap, int cfra)
if (ed == NULL) return 0;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->startdisp >= cfra) {
seq->start += gap;
calc_sequence(scene, seq);
@@ -872,8 +870,7 @@ static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
WM_cursor_wait(1);
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (seq->type == SEQ_MOVIE) {
if (seq->strip && seq->strip->stripdata) {
@@ -900,8 +897,7 @@ static void set_filter_seq(Scene *scene)
if (okee("Set Deinterlace") == 0) return;
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (seq->type == SEQ_MOVIE) {
seq->flag |= SEQ_FILTERY;
@@ -936,8 +932,7 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
if (strcmp(to, from) == 0)
return;
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (strncmp(seq->strip->dir, from, strlen(from)) == 0) {
printf("found %s\n", seq->strip->dir);
@@ -1482,7 +1477,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
BLI_movelisttolist(ed->seqbasep, &newlist);
if (cut_side != SEQ_SIDE_BOTH) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (cut_side == SEQ_SIDE_LEFT) {
if (seq->startdisp >= cut_frame) {
seq->flag &= ~SEQ_ALLSEL;
@@ -3015,7 +3010,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
}
seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem");
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(se->name, filename, sizeof(se->name));
MEM_freeN(filename);
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index c40a809e6af..e63a3052d26 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -51,7 +51,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(const struct bContext* C, struct Scene *scene,struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset);
+void draw_image_seq(const struct bContext* C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset);
void seq_reset_imageofs(struct SpaceSeq *sseq);
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 2447ca6cfbe..f326052ea60 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -362,7 +362,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
deselect_all_seq(scene);
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
- SEQP_BEGIN(ed, seq)
+ SEQP_BEGIN (ed, seq)
{
if (x < CFRA) {
if (seq->enddisp < CFRA) {
@@ -940,7 +940,7 @@ static short select_grouped_type(Editing *ed, Sequence *actseq)
Sequence *seq;
short changed = FALSE;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->type == actseq->type) {
seq->flag |= SELECT;
changed = TRUE;
@@ -957,7 +957,7 @@ static short select_grouped_type_basic(Editing *ed, Sequence *actseq)
short changed = FALSE;
short is_sound = SEQ_IS_SOUND(actseq);
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq)) {
seq->flag |= SELECT;
changed = TRUE;
@@ -974,7 +974,7 @@ static short select_grouped_type_effect(Editing *ed, Sequence *actseq)
short changed = FALSE;
short is_effect = SEQ_IS_EFFECT(actseq);
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq)) {
seq->flag |= SELECT;
changed = TRUE;
@@ -995,7 +995,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
return changed;
if (SEQ_HAS_PATH(actseq) && dir) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (SEQ_HAS_PATH(seq) && seq->strip && strcmp(seq->strip->dir, dir) == 0) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1005,7 +1005,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
}
else if (actseq->type == SEQ_SCENE) {
Scene *sce = actseq->scene;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->type == SEQ_SCENE && seq->scene == sce) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1015,7 +1015,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
}
else if (actseq->type == SEQ_MOVIECLIP) {
MovieClip *clip = actseq->clip;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->type == SEQ_MOVIECLIP && seq->clip == clip) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1037,14 +1037,14 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
for (i = 0; i <= SEQ_EFFECT_MAX; i++)
effects[i] = FALSE;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (ELEM3(actseq, seq->seq1, seq->seq2, seq->seq3)) {
effects[seq->type] = TRUE;
}
}
SEQ_END;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (effects[seq->type]) {
if (seq->seq1) seq->seq1->flag |= SELECT;
if (seq->seq2) seq->seq2->flag |= SELECT;
@@ -1062,7 +1062,7 @@ static short select_grouped_time_overlap(Editing *ed, Sequence *actseq)
Sequence *seq;
short changed = FALSE;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (!((seq->startdisp >= actseq->enddisp) || (seq->enddisp < actseq->startdisp))) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1083,7 +1083,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
int machine = actseq->machine;
SeqIterator iter;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
seq->tmp= NULL;
}
SEQ_END;
@@ -1153,7 +1153,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
}
if (extend == 0) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
seq->flag &= ~SELECT;
changed = TRUE;
}
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index ec340dd323e..e421ace75a0 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -466,6 +466,7 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_FRAME:
case ND_MARKERS:
case ND_SEQUENCER:
+ case ND_RENDER_OPTIONS:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index beccca51265..032cc4ecbf2 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -187,6 +187,7 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_paste);
WM_operatortype_append(TEXT_OT_copy);
WM_operatortype_append(TEXT_OT_cut);
+ WM_operatortype_append(TEXT_OT_duplicate_line);
WM_operatortype_append(TEXT_OT_convert_whitespace);
WM_operatortype_append(TEXT_OT_uncomment);
@@ -297,6 +298,8 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_cut", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_copy", INSERTKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_paste", INSERTKEY, KM_PRESS, KM_SHIFT, 0);
+
+ WM_keymap_add_item(keymap, "TEXT_OT_duplicate_line", DKEY, KM_PRESS, KM_CTRL, 0);
if (U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
kmi = WM_keymap_add_item(keymap, "TEXT_OT_paste", MIDDLEMOUSE, KM_PRESS, 0, 0);
@@ -353,7 +356,6 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", ENDKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "type", FILE_BOTTOM);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_NEXT_CHAR);
- RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_CHAR);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_PREV_CHAR);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", DEL_PREV_CHAR); /* same as above [#26623] */
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 84f960ecf2a..ffb686b6810 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -130,8 +130,7 @@ static void flatten_string_append(FlattenString *fs, const char *c, int accum, i
fs->accum = naccum;
}
- for (i = 0; i < len; i++)
- {
+ for (i = 0; i < len; i++) {
fs->buf[fs->pos + i] = c[i];
fs->accum[fs->pos + i] = accum;
}
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 2d297dd20d7..07d2dffb95b 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -118,6 +118,7 @@ void TEXT_OT_refresh_pyconstraints(struct wmOperatorType *ot);
void TEXT_OT_paste(struct wmOperatorType *ot);
void TEXT_OT_copy(struct wmOperatorType *ot);
void TEXT_OT_cut(struct wmOperatorType *ot);
+void TEXT_OT_duplicate_line(struct wmOperatorType *ot);
void TEXT_OT_convert_whitespace(struct wmOperatorType *ot);
void TEXT_OT_uncomment(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 730dfb7d979..f60217ba8ac 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -826,6 +826,36 @@ void TEXT_OT_paste(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Paste text selected elsewhere rather than copied (X11 only)");
}
+/**************** duplicate operator *******************/
+
+static int text_duplicate_line_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Text *text= CTX_data_edit_text(C);
+
+ txt_duplicate_line(text);
+
+ WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+
+ /* run the script while editing, evil but useful */
+ if (CTX_wm_space_text(C)->live_edit) {
+ text_run_script(C, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void TEXT_OT_duplicate_line(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Duplicate Line";
+ ot->idname = "TEXT_OT_duplicate_line";
+ ot->description = "Duplicate the current line";
+
+ /* api callbacks */
+ ot->exec = text_duplicate_line_exec;
+ ot->poll = text_edit_poll;
+}
+
/******************* copy operator *********************/
static void txt_copy_clipboard(Text *text)
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 23fff8fb274..f980e19e9c8 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -364,20 +364,6 @@ static short UNUSED_FUNCTION(do_texttools) (SpaceText * st, char ascii, unsigned
return swallow;
}
-#if 0
-#ifdef WITH_PYTHON
-/* Run text plugin scripts if enabled */
-if (st->doplugins && event && val)
-{
- if (BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, qual)) {
- do_draw = 1;
- }
-}
-#endif
-if (do_draw)
- ; // XXX redraw_alltext();
-#endif
-
static short UNUSED_FUNCTION(do_textmarkers) (SpaceText * st, char ascii, unsigned short evnt, short val)
{
Text *text;
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 5e56dfa728e..674dd670cf7 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -111,7 +111,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
int i, sta = pid->cache->startframe, end = pid->cache->endframe;
int len = (end - sta + 1)*4;
- switch(pid->type) {
+ switch (pid->type) {
case PTCACHE_TYPE_SOFTBODY:
if (!(stime->cache_display & TIME_CACHE_SOFTBODY)) continue;
break;
@@ -171,7 +171,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
glTranslatef(0.0, (float)V2D_SCROLL_HEIGHT+yoffs, 0.0);
glScalef(1.0, CACHE_DRAW_HEIGHT, 0.0);
- switch(pid->type) {
+ switch (pid->type) {
case PTCACHE_TYPE_SOFTBODY:
col[0] = 1.0; col[1] = 0.4; col[2] = 0.02;
col[3] = 0.1;
@@ -357,8 +357,7 @@ static void time_draw_keyframes(const bContext *C, SpaceTime *stime, ARegion *ar
short active_done = 0;
/* draw keyframes from all selected objects */
- CTX_DATA_BEGIN(C, Object*, obsel, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object*, obsel, selected_objects) {
/* last arg is 0, since onlysel doesn't apply here... */
time_draw_idblock_keyframes(v2d, (ID *)obsel, 0);
@@ -509,7 +508,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
if (wmn->data == ND_SPACE_TIME)
ED_region_tag_redraw(ar);
@@ -549,7 +548,7 @@ static void time_header_area_draw(const bContext *C, ARegion *ar)
static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCREEN:
if (wmn->data==ND_ANIMPLAY)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index e9bf9345b5c..6c683eba085 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -145,7 +145,7 @@ static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn
{
/* context changes */
#if 0
- switch(wmn->category) {
+ switch (wmn->category) {
default:
break;
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 4508dae36e7..1f431122929 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -47,6 +47,7 @@
#include "DNA_speaker_types.h"
#include "DNA_world_types.h"
#include "DNA_armature_types.h"
+#include "DNA_object_types.h"
#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
@@ -2213,7 +2214,7 @@ void nurbs_foreachScreenVert(
short s[2] = {IS_CLIPPED, 0};
Nurb *nu;
int i;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
@@ -3963,7 +3964,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
break;
case OB_MBALL:
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
lb = &ob->disp;
if (lb->first == NULL) makeDispListMBall(scene, ob);
if (lb->first == NULL) return 1;
@@ -5648,7 +5649,7 @@ static void curve_draw_speed(Scene *scene, Object *ob)
if (icu == NULL || icu->totvert < 2)
return;
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
for (a = 0, bezt = icu->bezt; a < icu->totvert; a++, bezt++) {
@@ -6140,7 +6141,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type)
bb = ob->bb ? ob->bb : ( (Curve *)ob->data)->bb;
}
else if (ob->type == OB_MBALL) {
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
bb = ob->bb;
if (bb == NULL) {
makeDispListMBall(scene, ob);
@@ -6231,7 +6232,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
}
else if (ob->type == OB_MBALL) {
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
if ((base->flag & OB_FROMDUPLI) == 0)
drawDispListwire(&ob->disp);
}
@@ -6291,7 +6292,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
}
}
else if (ob->type == OB_MBALL) {
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
drawDispListwire(&ob->disp);
}
}
@@ -6670,7 +6671,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
cu = ob->data;
if (cu->editnurb) {
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if (dt == OB_BOUNDBOX) {
@@ -7168,7 +7169,7 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
MVert *mvert = me->mvert;
data.mvert = mvert;
data.offset = (void *)(intptr_t) offset;
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data);
bglEnd();
@@ -7191,7 +7192,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
{
void *ptrs[2] = {(void *)(intptr_t) offset, em};
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, ptrs);
bglEnd();
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 0e520a511fe..2bb08a4b9b4 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -47,7 +47,6 @@
#include "BKE_curve.h"
#include "BKE_constraint.h" // for the get_constraint_target function
#include "BKE_DerivedMesh.h"
-#include "BKE_deform.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_font.h"
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index c3ff00e3c82..13129616843 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -211,7 +211,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
StructRNA *seltype = NULL;
void *selp = NULL;
@@ -333,7 +333,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, yi -= buth, 200, buth,
&(tfp->ve_median[1]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:",0, yi -= buth, 200, buth,
+ but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, yi -= buth, 200, buth,
&(tfp->ve_median[2]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
@@ -509,7 +509,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
const float scale_w = compute_scale_factor(ve_median[4], median[4]);
nu = nurbs->first;
@@ -571,8 +571,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bp++;
}
}
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
+ BKE_nurb_test2D(nu);
+ BKE_nurb_handles_test(nu); /* test for bezier too */
nu = nu->next;
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 6f637afd293..2f66fdf8cd4 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -700,11 +700,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
fac = fac * fac;
interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac);
}
- else
-#endif
- {
+ else {
copy_v3_v3(xaxis, m_inv[0]);
}
+#else
+ copy_v3_v3(xaxis, m_inv[0]);
+#endif
/* Determine the direction of the x vector (for rotating up and down) */
/* This can likely be computed directly from the quaternion. */
@@ -1554,7 +1555,9 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
if (!use_cam_zoom) {
if (zfac != 1.0f && zfac * vod->rv3d->dist > 0.001f * vod->grid &&
zfac * vod->rv3d->dist < 10.0f * vod->far)
+ {
view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
+ }
}
/* these limits were in old code too */
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index ab4eca2e303..c4309980b18 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -294,15 +294,15 @@ static char *view3d_modeselect_pup(Scene *scene)
if (!((ID *)ob->data)->lib) {
/* if active object is editable */
- if (ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
- str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
- }
- else if (ob->type == OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
if (ob->mode & OB_MODE_POSE)
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT | OB_MODE_POSE, ICON_EDITMODE_HLT);
else
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
+ else if (OB_TYPE_SUPPORT_EDITMODE(ob->type)) {
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
+ }
if (ob->type == OB_MESH) {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index ac9c32816dd..e1bbc0e1545 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -48,9 +48,12 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
+#include "BLI_lasso.h"
+#include "BLI_rect.h"
#include "BLI_rand.h"
#include "BLI_linklist.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
/* vertex box select */
@@ -319,79 +322,6 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
#define MOVES_GESTURE 50
#define MOVES_LASSO 500
-int lasso_inside(int mcords[][2], short moves, int sx, int sy)
-{
- /* we do the angle rule, define that all added angles should be about zero or 2*PI */
- float angletot = 0.0, len, dot, ang, cross, fp1[2], fp2[2];
- int a;
- int *p1, *p2;
-
- if (sx == IS_CLIPPED)
- return 0;
-
- p1 = mcords[moves - 1];
- p2 = mcords[0];
-
- /* first vector */
- fp1[0] = (float)(p1[0] - sx);
- fp1[1] = (float)(p1[1] - sy);
- len = sqrt(fp1[0] * fp1[0] + fp1[1] * fp1[1]);
- fp1[0] /= len;
- fp1[1] /= len;
-
- for (a = 0; a < moves; a++) {
- /* second vector */
- fp2[0] = (float)(p2[0] - sx);
- fp2[1] = (float)(p2[1] - sy);
- len = sqrt(fp2[0] * fp2[0] + fp2[1] * fp2[1]);
- fp2[0] /= len;
- fp2[1] /= len;
-
- /* dot and angle and cross */
- dot = fp1[0] * fp2[0] + fp1[1] * fp2[1];
- ang = fabs(saacos(dot));
-
- cross = (float)((p1[1] - p2[1]) * (p1[0] - sx) + (p2[0] - p1[0]) * (p1[1] - sy));
-
- if (cross < 0.0f) angletot -= ang;
- else angletot += ang;
-
- /* circulate */
- fp1[0] = fp2[0]; fp1[1] = fp2[1];
- p1 = p2;
- p2 = mcords[a + 1];
- }
-
- if (fabs(angletot) > 4.0) return 1;
- return 0;
-}
-
-/* edge version for lasso select. we assume boundbox check was done */
-int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1)
-{
- int v1[2], v2[2];
- int a;
-
- if (x0 == IS_CLIPPED || x1 == IS_CLIPPED)
- return 0;
-
- v1[0] = x0, v1[1] = y0;
- v2[0] = x1, v2[1] = y1;
-
- /* check points in lasso */
- if (lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
- if (lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
-
- /* no points in lasso, so we have to intersect with lasso edge */
-
- if (isect_line_line_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return 1;
- for (a = 0; a < moves - 1; a++) {
- if (isect_line_line_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return 1;
- }
-
- return 0;
-}
-
/* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN)
* and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK
@@ -412,7 +342,7 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], s
mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
project_int(vc->ar, vec, sco2);
- if (lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+ if (BLI_lasso_is_edge_inside(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1], IS_CLIPPED)) {
if (select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
}
@@ -441,7 +371,7 @@ static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short move
for (base = vc->scene->base.first; base; base = base->next) {
if (BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */
project_short(vc->ar, base->object->obmat[3], &base->sx);
- if (lasso_inside(mcords, moves, base->sx, base->sy)) {
+ if (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) {
if (select) ED_base_object_select(base, BA_SELECT);
else ED_base_object_select(base, BA_DESELECT);
@@ -454,26 +384,13 @@ static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short move
}
}
-static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves)
-{
- short a;
-
- rect->xmin = rect->xmax = mcords[0][0];
- rect->ymin = rect->ymax = mcords[0][1];
-
- for (a = 1; a < moves; a++) {
- if (mcords[a][0] < rect->xmin) rect->xmin = mcords[a][0];
- else if (mcords[a][0] > rect->xmax) rect->xmax = mcords[a][0];
- if (mcords[a][1] < rect->ymin) rect->ymin = mcords[a][1];
- else if (mcords[a][1] > rect->ymax) rect->ymax = mcords[a][1];
- }
-}
-
static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_in_rcti(data->rect, x, y) &&
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
+ {
BM_vert_select_set(data->vc->em->bm, eve, data->select);
}
}
@@ -484,14 +401,15 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int
if (EDBM_backbuf_check(bm_solidoffs + index)) {
if (data->pass == 0) {
if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1) &&
- lasso_inside(data->mcords, data->moves, x0, y0) &&
- lasso_inside(data->mcords, data->moves, x1, y1)) {
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, IS_CLIPPED) &&
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, IS_CLIPPED))
+ {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
data->done = 1;
}
}
else {
- if (lasso_inside_edge(data->mcords, data->moves, x0, y0, x1, y1)) {
+ if (BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, IS_CLIPPED)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
}
}
@@ -501,7 +419,9 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_in_rcti(data->rect, x, y) &&
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
+ {
BM_face_select_set(data->vc->em->bm, efa, data->select);
}
}
@@ -513,7 +433,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
rcti rect;
int bbsel;
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
/* set editmesh */
vc->em = BMEdit_FromObject(vc->obedit);
@@ -567,73 +487,13 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
EDBM_selectmode_flush(vc->em);
}
-/* BMESH_TODO */
-#if 0
-/* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */
-static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
-{
- EditFace *efa;
- MTFace *tf;
- int screenUV[2], nverts, i, ok = 1;
- rcti rect;
-
- lasso_select_boundbox(&rect, mcords, moves);
-
- if (draw_uvs_face_check()) { /* Face Center Sel */
- float cent[2];
- ok = 0;
- for (efa = em->faces.first; efa; efa = efa->next) {
- /* assume not touched */
- efa->tmp.l = 0;
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if ((select) != (simaFaceSel_Check(efa, tf))) {
- uv_center(tf->uv, cent, (void *)efa->v4);
- uvco_to_areaco_noclip(cent, screenUV);
- if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
- efa->tmp.l = ok = 1;
- }
- }
- }
- /* (de)selects all tagged faces and deals with sticky modes */
- if (ok)
- uvface_setsel__internal(select);
-
- }
- else { /* Vert Sel*/
- for (efa = em->faces.first; efa; efa = efa->next) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (uvedit_face_visible_test(scene, ima, efa, tf)) {
- nverts = efa->v4 ? 4 : 3;
- for (i = 0; i < nverts; i++) {
- if ((select) != (simaUVSel_Check(efa, tf, i))) {
- uvco_to_areaco_noclip(tf->uv[i], screenUV);
- if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
- if (select) {
- simaUVSel_Set(efa, tf, i);
- }
- else {
- simaUVSel_UnSet(efa, tf, i);
- }
- }
- }
- }
- }
- }
- }
- if (ok && G.sima->flag & SI_SYNC_UVSEL) {
- if (select) EM_select_flush(vc->em);
- else EM_deselect_flush(vc->em);
- }
-}
-#endif
-
static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
{
LassoSelectUserData *data = userData;
Object *obedit = data->vc->obedit;
Curve *cu = (Curve *)obedit->data;
- if (lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
@@ -681,7 +541,7 @@ static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x,
{
LassoSelectUserData *data = userData;
- if (lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
@@ -722,20 +582,22 @@ static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short mov
project_short(vc->ar, vec, sco2);
didpoint = 0;
- if (lasso_inside(mcords, moves, sco1[0], sco1[1])) {
+ if (BLI_lasso_is_point_inside(mcords, moves, sco1[0], sco1[1], IS_CLIPPED)) {
if (select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
didpoint = 1;
change = TRUE;
}
- if (lasso_inside(mcords, moves, sco2[0], sco2[1])) {
+ if (BLI_lasso_is_point_inside(mcords, moves, sco2[0], sco2[1], IS_CLIPPED)) {
if (select) ebone->flag |= BONE_TIPSEL;
else ebone->flag &= ~BONE_TIPSEL;
didpoint = 1;
change = TRUE;
}
/* if one of points selected, we skip the bone itself */
- if (didpoint == 0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+ if (didpoint == 0 &&
+ BLI_lasso_is_edge_inside(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1], IS_CLIPPED))
+ {
if (select) ebone->flag |= BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED;
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
change = TRUE;
@@ -771,7 +633,7 @@ static void do_lasso_select_meta(ViewContext *vc, int mcords[][2], short moves,
mul_v3_m4v3(vec, vc->obedit->obmat, &ml->x);
project_short(vc->ar, vec, sco);
- if (lasso_inside(mcords, moves, sco[0], sco[1])) {
+ if (BLI_lasso_is_point_inside(mcords, moves, sco[0], sco[1], IS_CLIPPED)) {
if (select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
}
@@ -850,7 +712,7 @@ static void do_lasso_select_paintvert(ViewContext *vc, int mcords[][2], short mo
paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
bm_vertoffs = me->totvert + 1; /* max index array */
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
edbm_backbuf_check_and_select_verts_obmode(me, select);
@@ -873,7 +735,7 @@ static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short mo
bm_vertoffs = me->totpoly + 1; /* max index array */
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
edbm_backbuf_check_and_select_tfaces(me, select);
@@ -893,7 +755,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
short node_cent[2];
float node_centf[2];
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
/* store selection in temp test flag */
for (node = snode->edittree->nodes.first; node; node = node->next) {
@@ -902,7 +764,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2;
ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
- if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && lasso_inside(mcords, moves, node_cent[0], node_cent[1])) {
+ if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
node->flag |= SELECT;
}
@@ -968,7 +830,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
int i = 0;
int mcords[1024][2];
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
@@ -1113,7 +975,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
const char *name = object_mouse_select_menu_data[name_index].idname;
if (!extend) {
- CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
changed = 1;
@@ -1122,7 +984,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
/* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
if (strcmp(name, base->object->id.name + 2) == 0) {
ED_base_object_activate(C, base);
@@ -1189,7 +1051,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
short ok;
LinkNode *linklist = NULL;
- CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
ok = FALSE;
/* two selection methods, the CTRL select uses max dist of 15 */
@@ -1967,7 +1829,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
if (extend == 0 && select) {
if (bone_only) {
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 1c1fa4c7fac..988d0a00601 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -106,7 +106,7 @@ static void special_transvert_update(Object *obedit)
}
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
Nurb *nu = nurbs->first;
while (nu) {
@@ -141,8 +141,8 @@ static void special_transvert_update(Object *obedit)
}
}
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
+ BKE_nurb_test2D(nu);
+ BKE_nurb_handles_test(nu); /* test for bezier too */
nu = nu->next;
}
}
@@ -375,7 +375,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
int totmalloc = 0;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
for (nu = nurbs->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER)
@@ -557,7 +557,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
else {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
- CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -691,7 +691,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
else {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
- CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -928,7 +928,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
}
else {
- CTX_DATA_BEGIN(C, Object *, ob, selected_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
copy_v3_v3(vec, ob->obmat[3]);
/* special case for camera -- snap to bundles */
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index f3819a1b83c..6d72ca99678 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -225,7 +225,11 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
adr[1]= out[1];
}
else if (t->spacetype==SPACE_CLIP) {
- UI_view2d_to_region_no_clip(t->view, vec[0], vec[1], adr, adr+1);
+ float v[2];
+
+ copy_v2_v2(v, vec);
+
+ UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
}
}
@@ -274,6 +278,19 @@ void applyAspectRatio(TransInfo *t, float *vec)
vec[0] /= aspx;
vec[1] /= aspy;
}
+ else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
+ if (t->options & CTX_MOVIECLIP) {
+ SpaceClip *sc = t->sa->spacedata.first;
+ float aspx, aspy;
+ int width, height;
+
+ ED_space_clip_size(sc, &width, &height);
+ ED_space_clip_aspect(sc, &aspx, &aspy);
+
+ vec[0] *= width / aspx;
+ vec[1] *= height / aspy;
+ }
+ }
}
void removeAspectRatio(TransInfo *t, float *vec)
@@ -294,12 +311,24 @@ void removeAspectRatio(TransInfo *t, float *vec)
vec[0] *= aspx;
vec[1] *= aspy;
}
+ else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
+ if (t->options & CTX_MOVIECLIP) {
+ SpaceClip *sc = t->sa->spacedata.first;
+ float aspx, aspy;
+ int width, height;
+
+ ED_space_clip_size(sc, &width, &height);
+ ED_space_clip_aspect(sc, &aspx, &aspy);
+
+ vec[0] *= aspx / width;
+ vec[1] *= aspy / height;
+ }
+ }
}
static void viewRedrawForce(const bContext *C, TransInfo *t)
{
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
/* Do we need more refined tags? */
if (t->flag & T_POSE)
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
@@ -415,7 +444,7 @@ static void view_editmove(unsigned short UNUSED(event))
if (Trans.flag & T_2D_EDIT)
return;
- switch(event) {
+ switch (event) {
case WHEELUPMOUSE:
if ( G.qual & LR_SHIFTKEY ) {
@@ -586,8 +615,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= handleMouseInput(t, &t->mouse, event);
- if (event->type == MOUSEMOVE)
- {
+ if (event->type == MOUSEMOVE) {
if (t->modifiers & MOD_CONSTRAINT_SELECT)
t->con.mode |= CON_SELECT;
@@ -626,10 +654,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= TREDRAW_HARD;
}
else if (t->mode == TFM_TRANSLATION) {
- if (t->options&CTX_MOVIECLIP) {
+ if(t->options & CTX_MOVIECLIP) {
restoreTransObjects(t);
- t->flag^= T_ALT_TRANSFORM;
+ t->flag ^= T_ALT_TRANSFORM;
t->redraw |= TREDRAW_HARD;
}
}
@@ -802,7 +830,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= handleNumInput(&(t->num), event);
}
/* else do non-mapped events */
- else if (event->val==KM_PRESS) {
+ else if (event->val == KM_PRESS) {
switch (event->type) {
case RIGHTMOUSE:
t->state = TRANS_CANCEL;
@@ -1088,11 +1116,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
/* confirm transform if launch key is released after mouse move */
- if (t->flag & T_RELEASE_CONFIRM)
- {
+ if (t->flag & T_RELEASE_CONFIRM) {
/* XXX Keyrepeat bug in Xorg fucks this up, will test when fixed */
- if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE))
- {
+ if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE)) {
t->state = TRANS_CONFIRM;
}
}
@@ -1156,20 +1182,19 @@ typedef enum {
} ArrowDirection;
static void drawArrow(ArrowDirection d, short offset, short length, short size)
{
- switch(d)
- {
+ switch (d) {
case LEFT:
offset = -offset;
length = -length;
size = -size;
case RIGHT:
glBegin(GL_LINES);
- glVertex2s( offset, 0);
- glVertex2s( offset + length, 0);
- glVertex2s( offset + length, 0);
- glVertex2s( offset + length - size, -size);
- glVertex2s( offset + length, 0);
- glVertex2s( offset + length - size, size);
+ glVertex2s(offset, 0);
+ glVertex2s(offset + length, 0);
+ glVertex2s(offset + length, 0);
+ glVertex2s(offset + length - size, -size);
+ glVertex2s(offset + length, 0);
+ glVertex2s(offset + length - size, size);
glEnd();
break;
case DOWN:
@@ -1178,12 +1203,12 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
size = -size;
case UP:
glBegin(GL_LINES);
- glVertex2s( 0, offset);
- glVertex2s( 0, offset + length);
- glVertex2s( 0, offset + length);
+ glVertex2s(0, offset);
+ glVertex2s(0, offset + length);
+ glVertex2s(0, offset + length);
glVertex2s(-size, offset + length - size);
- glVertex2s( 0, offset + length);
- glVertex2s( size, offset + length - size);
+ glVertex2s(0, offset + length);
+ glVertex2s(size, offset + length - size);
glEnd();
break;
}
@@ -1191,26 +1216,25 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
static void drawArrowHead(ArrowDirection d, short size)
{
- switch(d)
- {
+ switch (d) {
case LEFT:
size = -size;
case RIGHT:
glBegin(GL_LINES);
- glVertex2s( 0, 0);
- glVertex2s( -size, -size);
- glVertex2s( 0, 0);
- glVertex2s( -size, size);
+ glVertex2s(0, 0);
+ glVertex2s(-size, -size);
+ glVertex2s(0, 0);
+ glVertex2s(-size, size);
glEnd();
break;
case DOWN:
size = -size;
case UP:
glBegin(GL_LINES);
- glVertex2s( 0, 0);
+ glVertex2s(0, 0);
glVertex2s(-size, -size);
- glVertex2s( 0, 0);
- glVertex2s( size, -size);
+ glVertex2s(0, 0);
+ glVertex2s(size, -size);
glEnd();
break;
}
@@ -1223,11 +1247,10 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
glBegin(GL_LINE_STRIP);
- for ( angle = angle_start; angle < angle_end; angle += delta)
- {
- glVertex2f( cosf(angle) * size, sinf(angle) * size);
+ for ( angle = angle_start; angle < angle_end; angle += delta) {
+ glVertex2f(cosf(angle) * size, sinf(angle) * size);
}
- glVertex2f( cosf(angle_end) * size, sinf(angle_end) * size);
+ glVertex2f(cosf(angle_end) * size, sinf(angle_end) * size);
glEnd();
}
@@ -1245,8 +1268,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
{
TransInfo *t = (TransInfo*)customdata;
- if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR))
- {
+ if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) {
float vecrot[3], cent[2];
int mval[2];
@@ -1267,8 +1289,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
glPushMatrix();
- switch(t->helpline)
- {
+ switch (t->helpline) {
case HLP_SPRING:
UI_ThemeColor(TH_WIRE);
@@ -1417,23 +1438,23 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
/* convert flag to enum */
- switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
- {
- case (T_PROP_EDIT|T_PROP_CONNECTED):
- proportional = PROP_EDIT_CONNECTED;
- break;
- case T_PROP_EDIT:
- proportional = PROP_EDIT_ON;
- break;
- default:
- proportional = PROP_EDIT_OFF;
+ switch (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
+ case (T_PROP_EDIT|T_PROP_CONNECTED):
+ proportional = PROP_EDIT_CONNECTED;
+ break;
+ case T_PROP_EDIT:
+ proportional = PROP_EDIT_ON;
+ break;
+ default:
+ proportional = PROP_EDIT_OFF;
}
// If modal, save settings back in scene if not set as operator argument
if (t->flag & T_MODAL) {
/* save settings if not set in operator */
- if ( (prop = RNA_struct_find_property(op->ptr, "proportional")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
if (t->obedit)
ts->proportional = proportional;
@@ -1441,12 +1462,14 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
ts->proportional_objects = (proportional != PROP_EDIT_OFF);
}
- if ( (prop = RNA_struct_find_property(op->ptr, "proportional_size")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
ts->proportional_size = t->prop_size;
}
- if ( (prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
ts->prop_mode = t->prop_mode;
}
@@ -1460,34 +1483,31 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
if (t->spacetype == SPACE_VIEW3D) {
- if ( (prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
View3D *v3d = t->view;
-
+
v3d->twmode = t->current_orientation;
}
}
}
- if (RNA_struct_find_property(op->ptr, "proportional"))
- {
+ if (RNA_struct_find_property(op->ptr, "proportional")) {
RNA_enum_set(op->ptr, "proportional", proportional);
RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode);
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
}
- if ((prop = RNA_struct_find_property(op->ptr, "axis")))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "axis"))) {
RNA_property_float_set_array(op->ptr, prop, t->axis);
}
- if ((prop = RNA_struct_find_property(op->ptr, "mirror")))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
RNA_property_boolean_set(op->ptr, prop, t->flag & T_MIRROR);
}
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
/* constraint orientation can be global, event if user selects something else
* so use the orientation in the constraint if set
* */
@@ -1498,8 +1518,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
}
- if (t->con.mode & CON_APPLY)
- {
+ if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
constraint_axis[0] = 1;
}
@@ -1527,8 +1546,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->state = TRANS_STARTING;
- if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) {
if (RNA_property_boolean_get(op->ptr, prop)) {
options |= CTX_TEXTURE;
}
@@ -1540,8 +1558,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->launch_event = event ? event->type : -1;
- if (t->launch_event == EVT_TWEAK_R)
- {
+ if (t->launch_event == EVT_TWEAK_R) {
t->launch_event = RIGHTMOUSE;
}
else if (t->launch_event == EVT_TWEAK_L) {
@@ -1550,18 +1567,15 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
// XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0)
// For manipulator only, so assume LEFTMOUSE
- if (t->launch_event == 0)
- {
+ if (t->launch_event == 0) {
t->launch_event = LEFTMOUSE;
}
- if (!initTransInfo(C, t, op, event)) // internal data, mouse, vectors
- {
+ if (!initTransInfo(C, t, op, event)) { /* internal data, mouse, vectors */
return 0;
}
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
//calc_manipulator_stats(curarea);
initTransformOrientation(C, t);
@@ -1592,15 +1606,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
}
/* Stupid code to have Ctrl-Click on manipulator work ok */
- if (event)
- {
+ if (event) {
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
wmKeyMapItem *kmi;
- for (kmi = keymap->items.first; kmi; kmi = kmi->next)
- {
- if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS)
- {
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
(ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
(ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
@@ -1731,16 +1742,14 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
break;
}
- if (t->state == TRANS_CANCEL)
- {
+ if (t->state == TRANS_CANCEL) {
postTrans(C, t);
return 0;
}
/* overwrite initial values if operator supplied a non-null vector */
- if ( (prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */
if (RNA_property_array_check(prop)) {
@@ -1756,22 +1765,19 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
}
/* Transformation axis from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) {
RNA_property_float_get_array(op->ptr, prop, t->axis);
normalize_v3(t->axis);
copy_v3_v3(t->axis_orig, t->axis);
}
/* Constraint init from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
int constraint_axis[3];
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
- if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2])
- {
+ if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
t->con.mode |= CON_APPLY;
if (constraint_axis[0]) {
@@ -1797,8 +1803,7 @@ void transformApply(bContext *C, TransInfo *t)
{
t->context = C;
- if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT)))
- {
+ if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) {
selectConstraint(t);
if (t->transform) {
t->transform(t, t->mval); // calls recalcData()
@@ -1811,13 +1816,11 @@ void transformApply(bContext *C, TransInfo *t)
}
/* If auto confirm is on, break after one pass */
- if (t->options & CTX_AUTOCONFIRM)
- {
+ if (t->options & CTX_AUTOCONFIRM) {
t->state = TRANS_CONFIRM;
}
- if (BKE_ptcache_get_continue_physics())
- {
+ if (BKE_ptcache_get_continue_physics()) {
// TRANSFORM_FIX_ME
//do_screenhandlers(G.curscreen);
t->redraw |= TREDRAW_HARD;
@@ -1842,11 +1845,9 @@ int transformEnd(bContext *C, TransInfo *t)
t->context = C;
- if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING)
- {
+ if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) {
/* handle restoring objects */
- if (t->state == TRANS_CANCEL)
- {
+ if (t->state == TRANS_CANCEL) {
/* exception, edge slide transformed UVs too */
if (t->mode==TFM_EDGE_SLIDE)
doEdgeSlide(t, 0.0f);
@@ -1942,8 +1943,8 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl
/* axis-angle get limited with euler... */
float eul[3], oldeul[3];
- axis_angle_to_eulO( eul, EULER_ORDER_DEFAULT,axis, *angle);
- axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,oldAxis, oldAngle);
+ axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, axis, *angle);
+ axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle);
if (protectflag & OB_LOCK_ROTX)
eul[0]= oldeul[0];
@@ -1952,7 +1953,7 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl
if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
- eulO_to_axis_angle( axis, angle,eul, EULER_ORDER_DEFAULT);
+ eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT);
/* when converting to axis-angle, we need a special exception for the case when there is no axis */
if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) {
@@ -1998,7 +1999,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu
if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
- eul_to_quat( quat,eul);
+ eul_to_quat(quat, eul);
/* restore original quat size */
mul_qt_fl(quat, qlen);
@@ -2097,8 +2098,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
* - current space should be local
*/
memset(cob, 0, sizeof(bConstraintOb));
- if (td->ext)
- {
+ if (td->ext) {
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
/* objects and bones do normalization first too, otherwise
@@ -2175,15 +2175,15 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
/* copy results from cob->matrix */
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
- mat4_to_quat( td->ext->quat,cob.matrix);
+ mat4_to_quat(td->ext->quat, cob.matrix);
}
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
/* axis angle */
- mat4_to_axis_angle( &td->ext->quat[1], &td->ext->quat[0],cob.matrix);
+ mat4_to_axis_angle(&td->ext->quat[1], &td->ext->quat[0], cob.matrix);
}
else {
/* eulers */
- mat4_to_eulO( td->ext->rot, td->ext->rotOrder,cob.matrix);
+ mat4_to_eulO(td->ext->rot, td->ext->rotOrder, cob.matrix);
}
}
}
@@ -2209,7 +2209,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
if (td->flag & TD_SINGLESIZE)
return;
- size_to_mat4( cob.matrix,td->ext->size);
+ size_to_mat4(cob.matrix, td->ext->size);
}
/* Evaluate valid constraints */
@@ -2260,7 +2260,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
if (td->flag & TD_SINGLESIZE)
return;
- mat4_to_size( td->ext->size,cob.matrix);
+ mat4_to_size(td->ext->size, cob.matrix);
}
}
}
@@ -2271,8 +2271,7 @@ static void postInputWarp(TransInfo *t, float values[3])
{
mul_v3_fl(values, (float)(M_PI * 2));
- if (t->customData) /* non-null value indicates reversed input */
- {
+ if (t->customData) { /* non-null value indicates reversed input */
negate_v3(values);
}
}
@@ -2324,8 +2323,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (event->type == MIDDLEMOUSE && event->val==KM_PRESS)
- {
+ if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
// Use customData pointer to signal warp direction
if (t->customData == NULL)
t->customData = (void*)1;
@@ -2465,11 +2463,9 @@ int handleEventShear(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (event->type == MIDDLEMOUSE && event->val==KM_PRESS)
- {
+ if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
// Use customData pointer to signal Shear direction
- if (t->customData == NULL)
- {
+ if (t->customData == NULL) {
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
t->customData = (void*)1;
}
@@ -2603,7 +2599,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
}
if (t->con.mode & CON_APPLY) {
- switch(t->num.idx_max) {
+ switch (t->num.idx_max) {
case 0:
spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
break;
@@ -2632,7 +2628,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0]))==0 || (SIGN(a[1]) & SIGN(b[1]))==0 || (SIGN(a[2]) & SIGN(b[2]))==0)
/* smat is reference matrix, only scaled */
-static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
+static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
{
float vec[3];
@@ -2692,7 +2688,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
//print_v3("fsize", fsize);
}
else {
- mat3_to_size( fsize,tmat);
+ mat3_to_size(fsize, tmat);
}
protectedSizeBits(td->protectflag, fsize);
@@ -2755,8 +2751,7 @@ int Resize(TransInfo *t, const int mval[2])
char str[200];
/* for manipulator, center handle, the scaling can't be done relative to center */
- if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
- {
+ if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) {
ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
}
else {
@@ -2774,14 +2769,13 @@ int Resize(TransInfo *t, const int mval[2])
applySnapping(t, size);
- if (t->flag & T_AUTOVALUES)
- {
+ if (t->flag & T_AUTOVALUES) {
copy_v3_v3(size, t->auto_values);
}
copy_v3_v3(t->values, size);
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -2803,7 +2797,7 @@ int Resize(TransInfo *t, const int mval[2])
/* evil hack - redo resize if cliping needed */
if (t->flag & T_CLIP_UV && clipUVTransform(t, size, 1)) {
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize)
t->con.applySize(t, NULL, mat);
@@ -2972,14 +2966,14 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
add_v3_v3v3(td->loc, vec, center);
- sub_v3_v3v3(vec,td->loc,td->iloc);
+ sub_v3_v3v3(vec, td->loc, td->iloc);
protectedTransBits(td->protectflag, vec);
add_v3_v3v3(td->loc, td->iloc, vec);
if (td->flag & TD_USEQUAT) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
if (td->ext->quat) {
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
@@ -3008,8 +3002,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
copy_m3_m4(pmtx, t->poseobj->obmat);
invert_m3_m3(imtx, pmtx);
- if ((td->flag & TD_NO_LOC) == 0)
- {
+ if ((td->flag & TD_NO_LOC) == 0) {
sub_v3_v3v3(vec, td->center, center);
mul_m3_v3(pmtx, vec); // To Global space
@@ -3047,7 +3040,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if (td->ext->rotOrder == ROT_MODE_QUAT) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* this function works on end result */
@@ -3061,10 +3054,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(tquat, quat, iquat);
- quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat);
+ quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
/* this function works on end result */
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
@@ -3077,12 +3070,12 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate the total rotatation in eulers */
copy_v3_v3(eul, td->ext->irot);
- eulO_to_mat3( eulmat,eul, td->ext->rotOrder);
+ eulO_to_mat3(eulmat, eul, td->ext->rotOrder);
/* mat = transform, obmat = bone rotation */
mul_m3_m3m3(fmat, smat, eulmat);
- mat3_to_compatible_eulO( eul, td->ext->rot, td->ext->rotOrder,fmat);
+ mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
/* and apply (to end result only) */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
@@ -3093,8 +3086,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
}
}
else {
- if ((td->flag & TD_NO_LOC) == 0)
- {
+ if ((td->flag & TD_NO_LOC) == 0) {
/* translation */
sub_v3_v3v3(vec, td->center, center);
mul_m3_v3(mat, vec);
@@ -3116,7 +3108,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* euler or quaternion? */
if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* this function works on end result */
@@ -3129,10 +3121,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(tquat, quat, iquat);
- quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat);
+ quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
/* this function works on end result */
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
@@ -3145,11 +3137,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate the total rotatation in eulers */
add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
- eulO_to_mat3( obmat,eul, td->ext->rotOrder);
+ eulO_to_mat3(obmat, eul, td->ext->rotOrder);
/* mat = transform, obmat = object rotation */
mul_m3_m3m3(fmat, smat, obmat);
- mat3_to_compatible_eulO( eul, td->ext->rot, td->ext->rotOrder,fmat);
+ mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
/* correct back for delta rot */
sub_v3_v3v3(eul, eul, td->ext->drot);
@@ -3170,7 +3162,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
float mat[3][3];
int i;
- vec_rot_to_mat3( mat,axis, angle);
+ vec_rot_to_mat3(mat, axis, angle);
for (i = 0 ; i < t->total; i++, td++) {
@@ -3182,10 +3174,10 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
if (t->con.applyRot) {
t->con.applyRot(t, td, axis, NULL);
- vec_rot_to_mat3( mat,axis, angle * td->factor);
+ vec_rot_to_mat3(mat, axis, angle * td->factor);
}
else if (t->flag & T_PROP_EDIT) {
- vec_rot_to_mat3( mat,axis, angle * td->factor);
+ vec_rot_to_mat3(mat, axis, angle * td->factor);
}
ElementRotation(t, td, mat, t->around);
@@ -3271,8 +3263,8 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
float mat[3][3], smat[3][3], totmat[3][3];
int i;
- vec_rot_to_mat3( smat,axis1, angles[0]);
- vec_rot_to_mat3( totmat,axis2, angles[1]);
+ vec_rot_to_mat3(smat, axis1, angles[0]);
+ vec_rot_to_mat3(totmat, axis2, angles[1]);
mul_m3_m3m3(mat, smat, totmat);
@@ -3284,8 +3276,8 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
continue;
if (t->flag & T_PROP_EDIT) {
- vec_rot_to_mat3( smat,axis1, td->factor * angles[0]);
- vec_rot_to_mat3( totmat,axis2, td->factor * angles[1]);
+ vec_rot_to_mat3(smat, axis1, td->factor * angles[0]);
+ vec_rot_to_mat3(totmat, axis2, td->factor * angles[1]);
mul_m3_m3m3(mat, smat, totmat);
}
@@ -3332,8 +3324,8 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
}
(void)spos;
- vec_rot_to_mat3( smat,axis1, phi[0]);
- vec_rot_to_mat3( totmat,axis2, phi[1]);
+ vec_rot_to_mat3(smat, axis1, phi[0]);
+ vec_rot_to_mat3(totmat, axis2, phi[1]);
mul_m3_m3m3(mat, smat, totmat);
@@ -3440,7 +3432,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
autoik[0]= '\0';
if (t->con.mode & CON_APPLY) {
- switch(t->num.idx_max) {
+ switch (t->num.idx_max) {
case 0:
spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
break;
@@ -3491,7 +3483,7 @@ static void applyTranslation(TransInfo *t, float vec[3])
axis_angle_to_quat(quat, axis, angle);
- quat_to_mat3( mat,quat);
+ quat_to_mat3(mat, quat);
ElementRotation(t, td, mat, V3D_LOCAL);
}
@@ -3899,7 +3891,7 @@ void initBevel(TransInfo *t)
int handleEventBevel(TransInfo *t, wmEvent *event)
{
- if (event->val==KM_PRESS) {
+ if (event->val == KM_PRESS) {
if (!G.editBMesh) return 0;
switch (event->type) {
@@ -3932,7 +3924,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event)
int Bevel(TransInfo *t, const int UNUSED(mval[2]))
{
- float distance,d;
+ float distance, d;
int i;
char str[128];
const char *mode;
@@ -4185,9 +4177,9 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
/* we've tucked the scale in loc */
oldy= td->iloc[1];
- size_to_mat3( sizemat,td->iloc);
+ size_to_mat3(sizemat, td->iloc);
mul_m3_m3m3(tmat, tmat, sizemat);
- mat3_to_size( td->loc,tmat);
+ mat3_to_size(td->loc, tmat);
td->loc[1]= oldy;
}
@@ -4217,7 +4209,7 @@ int BoneSize(TransInfo *t, const int mval[2])
constraintNumInput(t, size);
}
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -4869,7 +4861,7 @@ void freeSlideVerts(TransInfo *t)
LinkNode *look = sld->vertlist;
GHash *vertgh = sld->vhash;
while (look) {
- sv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
+ sv = BLI_ghash_lookup(vertgh, (EditVert*)look->link);
if (sv != NULL) {
sv->up->f &= !SELECT;
sv->down->f &= !SELECT;
@@ -5175,7 +5167,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
if (t->con.mode & CON_APPLY) {
size[0] = size[1] = size[2] = -1;
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -5200,7 +5192,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
else {
size[0] = size[1] = size[2] = 1;
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
for (i = 0, td=t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@@ -5243,8 +5235,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
/* saving original center */
copy_v3_v3(center, t->center);
- for (i = 0 ; i < t->total; i++, td++)
- {
+ for (i = 0 ; i < t->total; i++, td++) {
float mat[3][3], invmat[3][3];
if (td->flag & TD_NOACTION)
@@ -5469,7 +5460,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
/* do the snapping to nearest frame/second */
if (doTime) {
- val= (float)( floor((val/secf) + 0.5f) * secf );
+ val= (float)(floor((val/secf) + 0.5f) * secf);
}
else
#endif
@@ -5608,9 +5599,9 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
if (autosnap == SACTSNAP_STEP) {
if (doTime)
- deltax= (float)( floor((deltax/secf) + 0.5f) * secf );
+ deltax= (float)(floor((deltax/secf) + 0.5f) * secf);
else
- deltax= (float)( floor(deltax + 0.5f) );
+ deltax= (float)(floor(deltax + 0.5f));
}
val = BKE_nla_tweakedit_remap(adt, td->ival, NLATIME_CONVERT_MAP);
@@ -5622,9 +5613,9 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
if (autosnap == SACTSNAP_STEP) {
if (doTime)
- val= (float)( floor((deltax/secf) + 0.5f) * secf );
+ val= (float)(floor((deltax/secf) + 0.5f) * secf);
else
- val= (float)( floor(val + 0.5f) );
+ val= (float)(floor(val + 0.5f));
}
*(td->val) = td->ival + val;
@@ -5874,9 +5865,9 @@ static void applyTimeScale(TransInfo *t)
if (autosnap == SACTSNAP_STEP) {
if (doTime)
- fac= (float)( floor(fac/secf + 0.5f) * secf );
+ fac= (float)(floor(fac/secf + 0.5f) * secf);
else
- fac= (float)( floor(fac + 0.5f) );
+ fac= (float)(floor(fac + 0.5f));
}
/* check if any need to apply nla-mapping */
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 0bef33149d7..69af8cf2489 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -68,7 +68,7 @@ struct ReportList;
struct SmallHash;
typedef struct TransSnapPoint {
- struct TransSnapPoint *next,*prev;
+ struct TransSnapPoint *next, *prev;
float co[3];
} TransSnapPoint;
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 18e9c1a47b8..b18d132f8df 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -76,8 +76,7 @@ static void drawObjectConstraint(TransInfo *t);
static void constraintAutoValues(TransInfo *t, float vec[3])
{
int mode = t->con.mode;
- if (mode & CON_APPLY)
- {
+ if (mode & CON_APPLY) {
float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
if ((mode & CON_AXIS0) == 0) {
@@ -478,7 +477,7 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl
if (!td && t->con.mode & CON_APPLY) {
int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
- switch(mode) {
+ switch (mode) {
case CON_AXIS0:
case (CON_AXIS1|CON_AXIS2):
copy_v3_v3(vec, t->con.mtx[0]);
@@ -525,7 +524,7 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
td= t->data;
}
- switch(mode) {
+ switch (mode) {
case CON_AXIS0:
case (CON_AXIS1|CON_AXIS2):
copy_v3_v3(vec, td->axismtx[0]);
@@ -604,7 +603,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
{
char text[40];
- switch(orientation) {
+ switch (orientation) {
case V3D_MANIP_GLOBAL:
{
float mtx[3][3]= MAT3_UNITY;
@@ -665,7 +664,7 @@ void drawConstraint(TransInfo *t)
else {
if (tc->mode & CON_SELECT) {
float vec[3];
- char col2[3] = {255,255,255};
+ char col2[3] = {255, 255, 255};
int depth_test_enabled;
convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1]));
@@ -768,7 +767,7 @@ static void drawObjectConstraint(TransInfo *t)
td++;
- for (i=1;i<t->total;i++,td++) {
+ for (i=1; i < t->total; i++, td++) {
if (t->con.mode & CON_AXIS0) {
drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0);
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 062f88f8837..ecd69f0d10c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -127,8 +127,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
TransData *itail = tail;
*temp = *head;
- while (head < tail)
- {
+ while (head < tail) {
if (t->flag & T_PROP_CONNECTED) {
while ((tail->dist >= temp->dist) && (head < tail))
tail--;
@@ -138,8 +137,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
tail--;
}
- if (head != tail)
- {
+ if (head != tail) {
*head = *tail;
head++;
}
@@ -153,8 +151,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
head++;
}
- if (head != tail)
- {
+ if (head != tail) {
*tail = *head;
tail--;
}
@@ -269,7 +266,7 @@ static void createTransTexspace(TransInfo *t)
}
id = ob->data;
- if (id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
+ if (id == NULL || !ELEM3(GS(id->name), ID_ME, ID_CU, ID_MB )) {
t->total = 0;
return;
}
@@ -421,57 +418,12 @@ static short apply_targetless_ik(Object *ob)
/* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */
/* we put in channel the entire result of rmat= (channel * constraint * IK) */
/* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */
- /* rmat = pose_mat(b) * inv( pose_mat(b-1) * offs_bone ) */
+ /* rmat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */
parchan= chanlist[segcount-1];
bone= parchan->bone;
bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */
- /* XXX Old code. Will remove it later. */
-#if 0
- if (parchan->parent) {
- Bone *parbone= parchan->parent->bone;
- float offs_bone[4][4];
-
- /* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */
- copy_m4_m3(offs_bone, bone->bone_mat);
-
- /* The bone's root offset (is in the parent's coordinate system) */
- copy_v3_v3(offs_bone[3], bone->head);
-
- /* Get the length translation of parent (length along y axis) */
- offs_bone[3][1]+= parbone->length;
-
- /* pose_mat(b-1) * offs_bone */
- if (parchan->bone->flag & BONE_HINGE) {
- /* the rotation of the parent restposition */
- copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
-
- /* the location of actual parent transform */
- copy_v3_v3(rmat[3], offs_bone[3]);
- offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
- mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
-
- mult_m4_m4m4(tmat, rmat, offs_bone);
- }
- else if (parchan->bone->flag & BONE_NO_SCALE) {
- mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
- normalize_m4(tmat);
- }
- else
- mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
-
- invert_m4_m4(imat, tmat);
- }
- else {
- copy_m4_m3(tmat, bone->bone_mat);
-
- copy_v3_v3(tmat[3], bone->head);
- invert_m4_m4(imat, tmat);
- }
- /* result matrix */
- mult_m4_m4m4(rmat, imat, parchan->pose_mat);
-#endif
armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat);
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
@@ -487,25 +439,25 @@ static short apply_targetless_ik(Object *ob)
* and applied poses.
*/
if (parchan->rotmode > 0)
- mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3);
+ mat3_to_eulO(parchan->eul, parchan->rotmode, rmat3);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- mat3_to_axis_angle(parchan->rotAxis, &parchan->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) */
if (data->flag & CONSTRAINT_IK_STRETCH) {
if (parchan->rotmode > 0)
- eulO_to_mat3( qrmat,parchan->eul, parchan->rotmode);
+ eulO_to_mat3(qrmat, parchan->eul, parchan->rotmode);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- axis_angle_to_mat3( qrmat,parchan->rotAxis, parchan->rotAngle);
+ axis_angle_to_mat3(qrmat, parchan->rotAxis, parchan->rotAngle);
else
- quat_to_mat3( qrmat,parchan->quat);
+ quat_to_mat3(qrmat, parchan->quat);
invert_m3_m3(imat3, qrmat);
mul_m3_m3m3(smat, rmat3, imat3);
- mat3_to_size( parchan->size,smat);
+ mat3_to_size(parchan->size, smat);
}
/* causes problems with some constraints (e.g. childof), so disable this */
@@ -535,13 +487,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ob = ob;
td->flag = TD_SELECTED;
- if (bone->flag & BONE_HINGE_CHILD_TRANSFORM)
- {
+ if (bone->flag & BONE_HINGE_CHILD_TRANSFORM) {
td->flag |= TD_NOCENTER;
}
- if (bone->flag & BONE_TRANSFORM_CHILD)
- {
+ if (bone->flag & BONE_TRANSFORM_CHILD) {
td->flag |= TD_NOCENTER;
td->flag |= TD_NO_LOC;
}
@@ -598,53 +548,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
if (constraints_list_needinv(t, &pchan->constraints)) {
copy_m3_m4(tmat, pchan->constinv);
invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, pmat, omat, cmat, NULL,NULL,NULL,NULL,NULL);
- }
- else
- mul_serie_m3(td->mtx, pmat, omat, NULL, NULL,NULL,NULL,NULL,NULL);
- }
-
- /* XXX Old code. Will remove it later. */
-#if 0
- if (ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION))
- unit_m3(bmat);
- else
- copy_m3_m3(bmat, pchan->bone->bone_mat);
-
- if (pchan->parent) {
- if (pchan->bone->flag & BONE_HINGE) {
- copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
- if (!(pchan->bone->flag & BONE_NO_SCALE)) {
- float tsize[3], tsmat[3][3];
- mat4_to_size(tsize, pchan->parent->pose_mat);
- size_to_mat3(tsmat, tsize);
- mul_m3_m3m3(pmat, tsmat, pmat);
- }
- }
- else {
- copy_m3_m4(pmat, pchan->parent->pose_mat);
- if (pchan->bone->flag & BONE_NO_SCALE)
- normalize_m3(pmat);
- }
-
- if (constraints_list_needinv(t, &pchan->constraints)) {
- copy_m3_m4(tmat, pchan->constinv);
- invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL);
- }
- else
- mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL);
- }
- else {
- if (constraints_list_needinv(t, &pchan->constraints)) {
- copy_m3_m4(tmat, pchan->constinv);
- invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL);
+ mul_serie_m3(td->mtx, pmat, omat, cmat, NULL, NULL, NULL, NULL, NULL);
}
else
- mul_m3_m3m3(td->mtx, omat, bmat);
+ mul_serie_m3(td->mtx, pmat, omat, NULL, NULL, NULL, NULL, NULL, NULL);
}
-# endif
invert_m3_m3(td->smtx, td->mtx);
@@ -773,7 +681,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
total++;
if (mode == TFM_TRANSLATION) {
- if ( has_targetless_ik(pchan)==NULL ) {
+ if (has_targetless_ik(pchan) == NULL) {
if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
hastranslation = 1;
@@ -826,7 +734,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
}
/* change the chain-length of auto-ik */
-void transform_autoik_update (TransInfo *t, short mode)
+void transform_autoik_update(TransInfo *t, short mode)
{
short *chainlen= &t->settings->autoik_chainlen;
bPoseChannel *pchan;
@@ -1443,7 +1351,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
if (cu->editnurb==NULL) return;
/* count total of vertices, check identical as in 2nd loop for making transdata! */
- nurbs= curve_editnurbs(cu);
+ nurbs= BKE_curve_editNurbs_get(cu);
for (nu= nurbs->first; nu; nu= nu->next) {
if (nu->type == CU_BEZIER) {
for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
@@ -1593,7 +1501,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
* but for now just don't change handle types */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
/* sets the handles based on their selection, do this after the data is copied to the TransData */
- testhandlesNurb(nu);
+ BKE_nurb_handles_test(nu);
}
}
else {
@@ -1708,7 +1616,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
PTCacheEditPoint *point;
PTCacheEditKey *key;
float mat[4][4];
- int i,k, transformparticle;
+ int i, k, transformparticle;
int count = 0, hasselected = 0;
int propmode = t->flag & T_PROP_EDIT;
@@ -1717,7 +1625,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
psys = edit->psys;
if (psys)
- psmd = psys_get_modifier(ob,psys);
+ psmd = psys_get_modifier(ob, psys);
base->flag |= BA_HAS_RECALC_DATA;
@@ -1757,7 +1665,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
unit_m4(mat);
- invert_m4_m4(ob->imat,ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
TransData *head, *tail;
@@ -1840,7 +1748,7 @@ void flushTransParticles(TransInfo *t)
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
for (k=0, key=point->keys; k<point->totkey; k++, key++) {
copy_v3_v3(co, key->world_co);
@@ -2147,7 +2055,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
* the modifiers that support deform matrices (defcos) */
if (totleft > 0) {
mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
- quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
+ quats= MEM_mallocN((t->total)*sizeof(float)*4, "crazy quats");
crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */
if (mappedcos)
MEM_freeN(mappedcos);
@@ -2225,7 +2133,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
/* Mirror? */
- if ( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
+ if ((mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
BMVert *vmir= EDBM_verts_mirror_get(em, eve); //t->obedit, em, eve, tob->iloc, a);
if (vmir && vmir != eve) {
tob->extra = vmir;
@@ -2239,7 +2147,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
if (mirror != 0)
{
tob = t->data;
- for ( a = 0; a < t->total; a++, tob++ )
+ for (a = 0; a < t->total; a++, tob++ )
{
if (ABS(tob->loc[0]) <= 0.00001f)
{
@@ -2386,7 +2294,7 @@ void flushTransSeq(TransInfo *t)
if (seq->depth==0) {
/* test overlap, displayes red outline */
seq->flag &= ~SEQ_OVERLAP;
- if ( seq_test_overlap(seqbasep, seq) ) {
+ if (seq_test_overlap(seqbasep, seq)) {
seq->flag |= SEQ_OVERLAP;
}
}
@@ -2707,8 +2615,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
center[2]= 0.0f;
/* set td's based on which handles are applicable */
- if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA))
- {
+ if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) {
/* just set tdn to assume that it only has one handle for now */
tdn->handle= -1;
@@ -2739,8 +2646,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->extra= tdn;
td++;
}
- if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA))
- {
+ if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) {
/* if tdn is already holding the start handle, then we're doing both, otherwise, only end */
tdn->handle= (tdn->handle) ? 2 : 1;
@@ -3081,14 +2987,14 @@ typedef struct tGPFtransdata {
} tGPFtransdata;
/* This function helps flush transdata written to tempdata into the gp-frames */
-void flushTransGPactionData (TransInfo *t)
+void flushTransGPactionData(TransInfo *t)
{
tGPFtransdata *tfd;
int i;
/* find the first one to start from */
if (t->mode == TFM_TIME_SLIDE)
- tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
+ tfd= (tGPFtransdata *)((float *)(t->customData) + 2);
else
tfd= (tGPFtransdata *)(t->customData);
@@ -3207,7 +3113,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
if (ac.datatype == ANIMCONT_GPENCIL) {
if (t->mode == TFM_TIME_SLIDE) {
t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata");
- tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
+ tfd= (tGPFtransdata *)((float *)(t->customData) + 2);
}
else {
t->customData= MEM_callocN(sizeof(tGPFtransdata)*count, "tGPFtransdata");
@@ -3562,9 +3468,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
* then check if we're using auto-handles.
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
- if ( ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
- ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
- ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
{
if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
@@ -3653,8 +3559,8 @@ static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED(
* optimization: this only needs to be performed in the first loop
*/
if (bezm->swapHs == 0) {
- if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
- (bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
+ if ((bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
+ (bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
{
/* handles need to be swapped */
bezm->swapHs = 1;
@@ -3753,7 +3659,7 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
* anim_data is the list of channels (F-Curves) retrieved already containing the
* channels to work on. It should not be freed here as it may still need to be used.
*/
-void remake_graph_transdata (TransInfo *t, ListBase *anim_data)
+void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
{
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
bAnimListElem *ale;
@@ -3808,9 +3714,9 @@ void flushTransGraphData(TransInfo *t)
switch (sipo->autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */
if (sipo->flag & SIPO_DRAWTIME)
- td2d->loc[0]= (float)( floor((td2d->loc[0]/secf) + 0.5f) * secf );
+ td2d->loc[0]= (float)(floor((td2d->loc[0]/secf) + 0.5f) * secf);
else
- td2d->loc[0]= (float)( floor(td2d->loc[0]+0.5f) );
+ td2d->loc[0]= (float)(floor(td2d->loc[0]+0.5f));
break;
case SACTSNAP_MARKER: /* snap to nearest marker */
@@ -3973,7 +3879,7 @@ static int SeqTransCount(TransInfo *t, Sequence *parent, ListBase *seqbase, int
for (seq= seqbase->first; seq; seq= seq->next) {
seq->depth= depth;
- /* seq->tmp is used by seq_tx_get_final_{left,right} to check sequence's range and clamp to it if needed.
+ /* seq->tmp is used by seq_tx_get_final_{left, right} to check sequence's range and clamp to it if needed.
* it's first place where digging into sequences tree, so store link to parent here */
seq->tmp = parent;
@@ -3993,7 +3899,7 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq
{
int start_left;
- switch(sel_flag) {
+ switch (sel_flag) {
case SELECT:
/* Use seq_tx_get_final_left() and an offset here
* so transform has the left hand location of the strip.
@@ -4267,9 +4173,9 @@ static void createTransSeqData(bContext *C, TransInfo *t)
int i;
for (i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
- if ( seq_user && (seq_user->flag & SELECT) &&
- !(seq_user->flag & SEQ_LOCK) &&
- !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
+ if (seq_user && (seq_user->flag & SELECT) &&
+ !(seq_user->flag & SEQ_LOCK) &&
+ !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
{
seq->flag |= SELECT;
}
@@ -4447,8 +4353,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
}
/* set active flag */
- if (ob == OBACT)
- {
+ if (ob == OBACT) {
td->flag |= TD_ACTIVE;
}
}
@@ -4500,8 +4405,7 @@ static void set_trans_object_base_flags(TransInfo *t)
parsel= parsel->parent;
}
- if (parsel)
- {
+ if (parsel) {
/* rotation around local centers are allowed to propagate */
if ((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL) {
base->flag |= BA_TRANSFORM_CHILD;
@@ -4534,10 +4438,8 @@ static int mark_children(Object *ob)
if (ob->flag & (SELECT|BA_TRANSFORM_CHILD))
return 1;
- if (ob->parent)
- {
- if (mark_children(ob->parent))
- {
+ if (ob->parent) {
+ if (mark_children(ob->parent)) {
ob->flag |= BA_TRANSFORM_CHILD;
return 1;
}
@@ -4554,8 +4456,7 @@ static int count_proportional_objects(TransInfo *t)
Base *base;
/* rotations around local centers are allowed to propagate, so we take all objects */
- if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL))
- {
+ if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL)) {
/* mark all parents */
for (base= scene->base.first; base; base= base->next) {
if (TESTBASELIB_BGMODE(v3d, scene, base)) {
@@ -4572,8 +4473,8 @@ static int count_proportional_objects(TransInfo *t)
/* mark all children */
for (base= scene->base.first; base; base= base->next) {
/* all base not already selected or marked that is editable */
- if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, scene, base)))
+ if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
mark_children(base->object);
}
@@ -4584,8 +4485,8 @@ static int count_proportional_objects(TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
- if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, scene, base)))
+ if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
/* used for flush, depgraph will change recalcs if needed :) */
@@ -4616,8 +4517,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
Scene *sce = t->scene;
Base *base;
- for (base= sce->base.first; base; base = base->next)
- {
+ for (base= sce->base.first; base; base = base->next) {
if (base->flag & BA_WAS_SEL)
base->flag |= SELECT;
@@ -4937,14 +4837,16 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
ED_node_link_intersect_test(t->sa, 0);
}
else if (t->spacetype == SPACE_CLIP) {
- SpaceClip *sc = t->sa->spacedata.first;
- MovieClip *clip = ED_space_clip(sc);
-
- if (t->scene->nodetree) {
- /* tracks can be used for stabilization nodes,
- * flush update for such nodes */
- nodeUpdateID(t->scene->nodetree, &clip->id);
- WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+ if (t->options & CTX_MOVIECLIP) {
+ SpaceClip *sc = t->sa->spacedata.first;
+ MovieClip *clip = ED_space_clip(sc);
+
+ if (t->scene->nodetree) {
+ /* tracks can be used for stabilization nodes,
+ * flush update for such nodes */
+ nodeUpdateID(t->scene->nodetree, &clip->id);
+ WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+ }
}
}
else if (t->spacetype == SPACE_ACTION) {
@@ -4975,8 +4877,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)) )
{
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1);
@@ -5006,8 +4908,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)))
{
posttrans_action_clean(&ac, (bAction *)ac.data);
}
@@ -5019,8 +4921,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)))
{
bGPdata *gpd;
@@ -5070,8 +4972,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
- if (ac.datatype)
- {
+ if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
@@ -5088,8 +4989,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)))
{
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
@@ -5120,8 +5021,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
- if (ac.datatype)
- {
+ if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
@@ -5147,8 +5047,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
}
else if (t->obedit) {
- if (t->obedit->type == OB_MESH)
- {
+ if (t->obedit->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(t->obedit);
/* table needs to be created for each edit command, since vertices can move etc */
mesh_octree_table(t->obedit, em, NULL, 'e');
@@ -5202,10 +5101,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
- else if ( (t->scene->basact) &&
- (ob = t->scene->basact->object) &&
- (ob->mode & OB_MODE_PARTICLE_EDIT) &&
- PE_get_current(t->scene, ob))
+ else if ((t->scene->basact) &&
+ (ob = t->scene->basact->object) &&
+ (ob->mode & OB_MODE_PARTICLE_EDIT) &&
+ PE_get_current(t->scene, ob))
{
/* do nothing */
}
@@ -5298,16 +5197,14 @@ static void createTransObject(bContext *C, TransInfo *t)
return;
}
- if (propmode)
- {
+ if (propmode) {
t->total += count_proportional_objects(t);
}
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransOb");
tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransObExtension");
- CTX_DATA_BEGIN(C, Base*, base, selected_bases)
- {
+ CTX_DATA_BEGIN (C, Base*, base, selected_bases) {
Object *ob= base->object;
td->flag = TD_SELECTED;
@@ -5315,8 +5212,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->ext = tx;
td->ext->rotOrder= ob->rotmode;
- if (base->flag & BA_TRANSFORM_CHILD)
- {
+ if (base->flag & BA_TRANSFORM_CHILD) {
td->flag |= TD_NOCENTER;
td->flag |= TD_NO_LOC;
}
@@ -5333,8 +5229,7 @@ static void createTransObject(bContext *C, TransInfo *t)
}
CTX_DATA_END;
- if (propmode)
- {
+ if (propmode) {
Scene *scene = t->scene;
View3D *v3d = t->view;
Base *base;
@@ -5343,7 +5238,8 @@ static void createTransObject(bContext *C, TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
- if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
+ if ((ob->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
+ BASE_EDITABLE_BGMODE(v3d, scene, base))
{
td->protectflag= ob->protectflag;
td->ext = tx;
@@ -5414,13 +5310,15 @@ static void createTransNodeData(bContext *C, TransInfo *t)
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransNode TransData");
td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransNode TransData2D");
- CTX_DATA_BEGIN(C, bNode *, selnode, selected_nodes)
+ CTX_DATA_BEGIN (C, bNode *, selnode, selected_nodes)
NodeToTransData(td++, td2d++, selnode);
CTX_DATA_END
}
/* *** CLIP EDITOR *** */
+/* * motion tracking * */
+
enum {
transDataTracking_ModeTracks = 0,
transDataTracking_ModeCurves = 1,
@@ -5749,10 +5647,13 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
+ int width, height;
t->total = 0;
- if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
+ BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+
+ if (!clip || width == 0 || height == 0)
return;
if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
@@ -5939,7 +5840,8 @@ void createTransData(bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_CLIP) {
t->flag |= T_POINTS|T_2D_EDIT;
- createTransTrackingData(C, t);
+ if (t->options & CTX_MOVIECLIP)
+ createTransTrackingData(C, t);
}
else if (t->obedit) {
t->ext = NULL;
@@ -6032,12 +5934,10 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
- if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW))
- {
+ if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
View3D *v3d = t->view;
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
- {
+ if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) {
t->flag |= T_CAMERA;
}
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b500398dd76..0bf02d1a2bf 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -111,8 +111,7 @@
void getViewVector(TransInfo *t, float coord[3], float vec[3])
{
- if (t->persp != RV3D_ORTHO)
- {
+ if (t->persp != RV3D_ORTHO) {
float p1[4], p2[4];
copy_v3_v3(p1, coord);
@@ -256,8 +255,7 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
eve->co[2]= td->loc[2];
}
- if (td->flag & TD_MIRROR_EDGE)
- {
+ if (td->flag & TD_MIRROR_EDGE) {
td->loc[0] = 0;
}
}
@@ -635,15 +633,16 @@ static void recalcData_image(TransInfo *t)
}
/* helper for recalcData() - for Movie Clip transforms */
-static void recalcData_clip(TransInfo *t)
+static void recalcData_spaceclip(TransInfo *t)
{
SpaceClip *sc = t->sa->spacedata.first;
+
MovieClip *clip = ED_space_clip(sc);
ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
MovieTrackingTrack *track;
-
+
flushTransTracking(t);
-
+
track = tracksbase->first;
while (track) {
if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
@@ -660,10 +659,10 @@ static void recalcData_clip(TransInfo *t)
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
}
-
+
track = track->next;
}
-
+
DAG_id_tag_update(&clip->id, 0);
}
@@ -675,7 +674,7 @@ static void recalcData_view3d(TransInfo *t)
if (t->obedit) {
if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu= t->obedit->data;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
Nurb *nu= nurbs->first;
if (t->state != TRANS_CANCEL) {
@@ -687,15 +686,15 @@ static void recalcData_view3d(TransInfo *t)
if (t->state == TRANS_CANCEL) {
while (nu) {
- calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
}
else {
/* Normal updating */
while (nu) {
- test2DNurb(nu);
- calchandlesNurb(nu);
+ BKE_nurb_test2D(nu);
+ BKE_nurb_handles_calc(nu);
nu= nu->next;
}
}
@@ -775,21 +774,17 @@ static void recalcData_view3d(TransInfo *t)
}
- if (t->mode != TFM_BONE_ROLL)
- {
+ if (t->mode != TFM_BONE_ROLL) {
/* fix roll */
- for (i = 0; i < t->total; i++, td++)
- {
- if (td->extra)
- {
+ for (i = 0; i < t->total; i++, td++) {
+ if (td->extra) {
float vec[3], up_axis[3];
float qrot[4];
ebo = td->extra;
copy_v3_v3(up_axis, td->axismtx[2]);
- if (t->mode != TFM_ROTATION)
- {
+ if (t->mode != TFM_ROTATION) {
sub_v3_v3v3(vec, ebo->tail, ebo->head);
normalize_v3(vec);
rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
@@ -906,7 +901,7 @@ void recalcData(TransInfo *t)
recalcData_view3d(t);
}
else if (t->spacetype == SPACE_CLIP) {
- recalcData_clip(t);
+ recalcData_spaceclip(t);
}
}
@@ -915,8 +910,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
float v1[3], v2[3], v3[3];
unsigned char col[3], col2[3];
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = t->view;
glPushMatrix();
@@ -955,7 +949,7 @@ void resetTransRestrictions(TransInfo *t)
}
/* the *op can be NULL */
-int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
+int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
{
Scene *sce = CTX_data_scene(C);
ToolSettings *ts = CTX_data_tool_settings(C);
@@ -984,8 +978,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->redraw = 1; /* redraw first time */
- if (event)
- {
+ if (event) {
copy_v2_v2_int(t->imval, event->mval);
t->event_type = event->type;
}
@@ -1043,8 +1036,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
t->view = v3d;
@@ -1060,12 +1052,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
t->around = v3d->around;
- if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_struct_property_is_set(op->ptr, "constraint_orientation"))
+ if (op && (RNA_struct_find_property(op->ptr, "constraint_orientation") &&
+ RNA_struct_property_is_set(op->ptr, "constraint_orientation")))
{
t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation");
-
- if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C))
- {
+
+ if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) {
t->current_orientation = V3D_MANIP_GLOBAL;
}
}
@@ -1124,10 +1116,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->around = V3D_CENTER;
}
- if (op && RNA_struct_property_is_set(op->ptr, "release_confirm"))
- {
- if (RNA_boolean_get(op->ptr, "release_confirm"))
- {
+ if (op && RNA_struct_property_is_set(op->ptr, "release_confirm")) {
+ if (RNA_boolean_get(op->ptr, "release_confirm")) {
t->flag |= T_RELEASE_CONFIRM;
}
}
@@ -1137,35 +1127,31 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
- if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_struct_property_is_set(op->ptr, "mirror"))
+ if (op && (RNA_struct_find_property(op->ptr, "mirror") &&
+ RNA_struct_property_is_set(op->ptr, "mirror")))
{
- if (RNA_boolean_get(op->ptr, "mirror"))
- {
+ if (RNA_boolean_get(op->ptr, "mirror")) {
t->flag |= T_MIRROR;
t->mirror = 1;
}
}
// Need stuff to take it from edit mesh or whatnot here
else if (t->spacetype == SPACE_VIEW3D) {
- if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X))
- {
+ if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X)) {
t->flag |= T_MIRROR;
t->mirror = 1;
}
}
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
- if (op && RNA_struct_find_property(op->ptr, "proportional"))
- {
- if (RNA_struct_property_is_set(op->ptr, "proportional"))
- {
- switch(RNA_enum_get(op->ptr, "proportional"))
- {
- case PROP_EDIT_CONNECTED:
- t->flag |= T_PROP_CONNECTED;
- case PROP_EDIT_ON:
- t->flag |= T_PROP_EDIT;
- break;
+ if (op && RNA_struct_find_property(op->ptr, "proportional")) {
+ if (RNA_struct_property_is_set(op->ptr, "proportional")) {
+ switch (RNA_enum_get(op->ptr, "proportional")) {
+ case PROP_EDIT_CONNECTED:
+ t->flag |= T_PROP_CONNECTED;
+ case PROP_EDIT_ON:
+ t->flag |= T_PROP_EDIT;
+ break;
}
}
else {
@@ -1186,7 +1172,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
- if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_struct_property_is_set(op->ptr, "proportional_size"))
+ if (op && (RNA_struct_find_property(op->ptr, "proportional_size") &&
+ RNA_struct_property_is_set(op->ptr, "proportional_size")))
{
t->prop_size = RNA_float_get(op->ptr, "proportional_size");
}
@@ -1196,13 +1183,13 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
/* TRANSFORM_FIX_ME rna restrictions */
- if (t->prop_size <= 0.00001f)
- {
+ if (t->prop_size <= 0.00001f) {
printf("Proportional size (%f) under 0.00001, reseting to 1!\n", t->prop_size);
t->prop_size = 1.0f;
}
- if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff"))
+ if (op && (RNA_struct_find_property(op->ptr, "proportional_edit_falloff") &&
+ RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff")))
{
t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff");
}
@@ -1210,14 +1197,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->prop_mode = ts->prop_mode;
}
}
- else /* add not pet option to context when not available */
- {
+ else { /* add not pet option to context when not available */
t->options |= CTX_NO_PET;
}
// Mirror is not supported with PET, turn it off.
- if (t->flag & T_PROP_EDIT)
- {
+ if (t->flag & T_PROP_EDIT) {
t->flag &= ~T_MIRROR;
}
@@ -1228,7 +1213,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
-void postTrans (bContext *C, TransInfo *t)
+void postTrans(bContext *C, TransInfo *t)
{
TransData *td;
@@ -1282,8 +1267,7 @@ void postTrans (bContext *C, TransInfo *t)
}
}
- if (t->mouse.data)
- {
+ if (t->mouse.data) {
MEM_freeN(t->mouse.data);
}
}
@@ -1440,8 +1424,7 @@ void calculateCenterMedian(TransInfo *t)
for (i = 0; i < t->total; i++) {
if (t->data[i].flag & TD_SELECTED) {
- if (!(t->data[i].flag & TD_NOCENTER))
- {
+ if (!(t->data[i].flag & TD_NOCENTER)) {
add_v3_v3(partial, t->data[i].center);
total++;
}
@@ -1493,7 +1476,7 @@ void calculateCenterBound(TransInfo *t)
void calculateCenter(TransInfo *t)
{
- switch(t->around) {
+ switch (t->around) {
case V3D_CENTER:
calculateCenterBound(t);
break;
@@ -1542,8 +1525,7 @@ void calculateCenter(TransInfo *t)
} /* END EDIT MODE ACTIVE ELEMENT */
calculateCenterMedian(t);
- if ((t->flag & (T_EDIT|T_POSE))==0)
- {
+ if ((t->flag & (T_EDIT|T_POSE))==0) {
Scene *scene = t->scene;
Object *ob= OBACT;
if (ob) {
@@ -1583,8 +1565,7 @@ void calculateCenter(TransInfo *t)
projectIntView(t, axis, t->center2d);
/* rotate only needs correct 2d center, grab needs initgrabz() value */
- if (t->mode==TFM_TRANSLATION)
- {
+ if (t->mode==TFM_TRANSLATION) {
copy_v3_v3(t->center, axis);
copy_v3_v3(t->con.center, t->center);
}
@@ -1625,11 +1606,8 @@ void calculatePropRatio(TransInfo *t)
td->factor = 0.0f;
restoreElement(td);
}
- else if ((connected &&
- (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
- ||
- (connected == 0 &&
- td->rdist > t->prop_size))
+ else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) ||
+ (connected == 0 && td->rdist > t->prop_size))
{
/*
* The elements are sorted according to their dist member in the array,
@@ -1656,7 +1634,7 @@ void calculatePropRatio(TransInfo *t)
if (dist < 0.0f)
dist = 0.0f;
- switch(t->prop_mode) {
+ switch (t->prop_mode) {
case PROP_SHARP:
td->factor= dist*dist;
break;
@@ -1676,7 +1654,7 @@ void calculatePropRatio(TransInfo *t)
td->factor = (float)sqrt(2*dist - dist * dist);
break;
case PROP_RANDOM:
- BLI_srand( BLI_rand() ); /* random seed */
+ BLI_srand(BLI_rand()); /* random seed */
td->factor = BLI_frand()*dist;
break;
default:
@@ -1684,7 +1662,7 @@ void calculatePropRatio(TransInfo *t)
}
}
}
- switch(t->prop_mode) {
+ switch (t->prop_mode) {
case PROP_SHARP:
strcpy(t->proptext, "(Sharp)");
break;
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index bd3fb20f77f..467e3dc600e 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -313,8 +313,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
}
#endif
- switch(mode)
- {
+ switch (mode) {
case INPUT_VECTOR:
mi->apply = InputVector;
t->helpline = HLP_NONE;
@@ -391,8 +390,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
{
int redraw = TREDRAW_NOTHING;
- switch (event->type)
- {
+ switch (event->type) {
case LEFTSHIFTKEY:
case RIGHTSHIFTKEY:
if (event->val == KM_PRESS) {
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 5b70b25c894..093c81c8d37 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -297,7 +297,7 @@ int calc_manipulator_stats(const bContext *C)
if (obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
BMEditSelection ese;
- float vec[3]= {0,0,0};
+ float vec[3]= {0, 0, 0};
/* USE LAST SELECTE WITH ACTIVE */
if ((v3d->around == V3D_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) {
@@ -389,7 +389,7 @@ int calc_manipulator_stats(const bContext *C)
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
nu= nurbs->first;
while (nu) {
@@ -508,7 +508,7 @@ int calc_manipulator_stats(const bContext *C)
if (edit) {
point = edit->points;
- for (a=0; a<edit->totpoint; a++,point++) {
+ for (a=0; a<edit->totpoint; a++, point++) {
if (point->flag & PEP_HIDE) continue;
for (k=0, ek=point->keys; k<point->totkey; k++, ek++) {
@@ -549,7 +549,7 @@ int calc_manipulator_stats(const bContext *C)
/* global, local or normal orientation? */
if (ob && totsel) {
- switch(v3d->twmode) {
+ switch (v3d->twmode) {
case V3D_MANIP_GLOBAL:
break; /* nothing to do */
@@ -643,7 +643,7 @@ static float screen_aligned(RegionView3D *rv3d, float mat[][4])
glTranslatef(mat[3][0], mat[3][1], mat[3][2]);
/* sets view screen aligned */
- glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
+ glRotatef(-360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
return len_v3(mat[0]); /* draw scale */
}
@@ -761,7 +761,7 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
}
else {
- switch(axis) {
+ switch (axis) {
case 'C':
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
if (v3d->twmode == V3D_MANIP_LOCAL) {
@@ -884,7 +884,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glClipPlane(GL_CLIP_PLANE0, plane);
}
/* sets view screen aligned */
- glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
+ glRotatef(-360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
/* Screen aligned help circle */
if (arcs) {
@@ -1483,7 +1483,7 @@ void BIF_draw_manipulator(const bContext *C)
v3d->twflag |= V3D_DRAW_MANIPULATOR;
/* now we can define center */
- switch(v3d->around) {
+ switch (v3d->around) {
case V3D_CENTER:
case V3D_ACTIVE:
rv3d->twmat[3][0]= (scene->twmin[0] + scene->twmax[0])/2.0f;
@@ -1512,7 +1512,7 @@ void BIF_draw_manipulator(const bContext *C)
if (v3d->twflag & V3D_DRAW_MANIPULATOR) {
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
if (v3d->twtype & V3D_MANIP_ROTATE) {
@@ -1553,7 +1553,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
setwinmatrixview3d(ar, v3d, &rect);
mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
- glSelectBuffer( 64, buffer);
+ glSelectBuffer(64, buffer);
glRenderMode(GL_SELECT);
glInitNames(); /* these two calls whatfor? It doesnt work otherwise */
glPushName(-2);
@@ -1639,7 +1639,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
if (drawflags==0) drawflags= val;
if (drawflags & MAN_TRANS_C) {
- switch(drawflags) {
+ switch (drawflags) {
case MAN_TRANS_C:
break;
case MAN_TRANS_X:
@@ -1672,7 +1672,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_translate", 0), event, op->ptr, NULL, FALSE);
}
else if (drawflags & MAN_SCALE_C) {
- switch(drawflags) {
+ switch (drawflags) {
case MAN_SCALE_X:
if (shift) {
constraint_axis[1] = 1;
@@ -1707,7 +1707,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_trackball", 0), event, op->ptr, NULL, FALSE);
}
else if (drawflags & MAN_ROT_C) {
- switch(drawflags) {
+ switch (drawflags) {
case MAN_ROT_X:
constraint_axis[0] = 1;
break;
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 09078c199c4..83d4a5dfa6e 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -145,7 +145,7 @@ static int snap_type_exec(bContext *C, wmOperator *op)
{
ToolSettings *ts= CTX_data_tool_settings(C);
- ts->snap_mode = RNA_enum_get(op->ptr,"type");
+ ts->snap_mode = RNA_enum_get(op->ptr, "type");
WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
@@ -317,23 +317,19 @@ static void transformops_exit(bContext *C, wmOperator *op)
static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
{
int retval = 1;
- if (op->customdata == NULL)
- {
+ if (op->customdata == NULL) {
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2");
TransformModeItem *tmode;
int mode = -1;
- for (tmode = transform_modes; tmode->idname; tmode++)
- {
- if (op->type->idname == tmode->idname)
- {
+ for (tmode = transform_modes; tmode->idname; tmode++) {
+ if (op->type->idname == tmode->idname) {
mode = tmode->mode;
break;
}
}
- if (mode == -1)
- {
+ if (mode == -1) {
mode = RNA_enum_get(op->ptr, "mode");
}
@@ -376,8 +372,7 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
exit_code |= transformEnd(C, t);
- if ((exit_code & OPERATOR_RUNNING_MODAL) == 0)
- {
+ if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) {
transformops_exit(C, op);
exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */
}
@@ -400,8 +395,7 @@ static int transform_exec(bContext *C, wmOperator *op)
{
TransInfo *t;
- if (!transformops_data(C, op, NULL))
- {
+ if (!transformops_data(C, op, NULL)) {
G.moving = 0;
return OPERATOR_CANCELLED;
}
@@ -423,8 +417,7 @@ static int transform_exec(bContext *C, wmOperator *op)
static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if (!transformops_data(C, op, event))
- {
+ if (!transformops_data(C, op, event)) {
G.moving = 0;
return OPERATOR_CANCELLED;
}
@@ -445,8 +438,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
{
PropertyRNA *prop;
- if (flags & P_AXIS)
- {
+ if (flags & P_AXIS) {
prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
RNA_def_property_array(prop, 3);
/* Make this not hidden when there's a nice axis selection widget */
@@ -455,8 +447,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
- if (flags & P_CONSTRAINT)
- {
+ if (flags & P_CONSTRAINT) {
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
@@ -465,21 +456,18 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
- if (flags & P_MIRROR)
- {
+ if (flags & P_MIRROR) {
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
- if (flags & P_PROPORTIONAL)
- {
+ if (flags & P_PROPORTIONAL) {
RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100);
}
- if (flags & P_SNAP)
- {
+ if (flags & P_SNAP) {
prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -497,14 +485,12 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
}
}
-
- if (flags & P_OPTIONS)
- {
+
+ if (flags & P_OPTIONS) {
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
}
- if (flags & P_CORRECT_UV)
- {
+ if (flags & P_CORRECT_UV) {
RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
}
@@ -827,8 +813,7 @@ void transform_operatortypes(void)
{
TransformModeItem *tmode;
- for (tmode = transform_modes; tmode->idname; tmode++)
- {
+ for (tmode = transform_modes; tmode->idname; tmode++) {
WM_operatortype_append(tmode->opfunc);
}
@@ -853,15 +838,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
if (modalmap) {
TransformModeItem *tmode;
- for (tmode = transform_modes; tmode->idname; tmode++)
- {
+ for (tmode = transform_modes; tmode->idname; tmode++) {
WM_modalkeymap_assign(modalmap, tmode->idname);
}
WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
}
- switch(spaceid)
- {
+ switch (spaceid) {
case SPACE_VIEW3D:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 0f929003e8f..04207643aa4 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -176,8 +176,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na
type = getTransformOrientation(C, normal, plane, 0);
- switch (type)
- {
+ switch (type) {
case ORIENTATION_VERT:
if (createSpaceNormal(mat, normal) == 0) {
BKE_reports_prepend(reports, "Cannot use vertex with zero-length normal");
@@ -493,7 +492,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
Object *ob = CTX_data_active_object(C);
Object *obedit = CTX_data_active_object(C);
- switch(t->current_orientation) {
+ switch (t->current_orientation) {
case V3D_MANIP_GLOBAL:
unit_m3(t->spacemtx);
strcpy(t->spacename, "global");
@@ -574,15 +573,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMEditSelection ese;
- float vec[3]= {0,0,0};
+ float vec[3]= {0, 0, 0};
/* USE LAST SELECTED WITH ACTIVE */
if (activeOnly && BM_select_history_active_get(em->bm, &ese)) {
BM_editselection_normal(&ese, normal);
BM_editselection_plane(&ese, plane);
- switch (ese.htype)
- {
+ switch (ese.htype) {
case BM_VERT:
result = ORIENTATION_VERT;
break;
@@ -717,15 +715,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
Nurb *nu;
BezTriple *bezt;
int a;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
for (nu = nurbs->first; nu; nu = nu->next) {
/* only bezier has a normal */
if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while (a--)
- {
+ while (a--) {
/* exception */
if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) {
sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]);
@@ -772,7 +769,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
float mat[4][4];
/* Rotation of MetaElem is stored in quat */
- quat_to_mat4( mat,ml_sel->quat);
+ quat_to_mat4(mat, ml_sel->quat);
copy_v3_v3(normal, mat[2]);
@@ -886,8 +883,7 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[]
type = getTransformOrientation(C, normal, plane, activeOnly);
- switch (type)
- {
+ switch (type) {
case ORIENTATION_NORMAL:
if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) {
type = ORIENTATION_NONE;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 7bdd3ddc069..fa579293a73 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -140,8 +140,7 @@ int activeSnap(TransInfo *t)
void drawSnapping(const struct bContext *C, TransInfo *t)
{
- if (validSnap(t) && activeSnap(t))
- {
+ if (validSnap(t) && activeSnap(t)) {
unsigned char col[4], selectedCol[4], activeCol[4];
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
@@ -184,16 +183,15 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
}
/* draw normal if needed */
- if (usingSnappingNormal(t) && validSnappingNormal(t))
- {
+ if (usingSnappingNormal(t) && validSnappingNormal(t)) {
glColor4ubv(activeCol);
glBegin(GL_LINES);
glVertex3f(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
- glVertex3f( t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
- t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1],
- t->tsnap.snapPoint[2] + t->tsnap.snapNormal[2]);
- glEnd();
+ glVertex3f(t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
+ t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1],
+ t->tsnap.snapPoint[2] + t->tsnap.snapNormal[2]);
+ glEnd();
}
if (v3d->zbuf)
@@ -218,7 +216,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
cpack(0xFFFFFF);
glTranslatef(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], 0.0f);
- //glRectf(0,0,1,1);
+ //glRectf(0, 0, 1, 1);
setlinestyle(0);
cpack(0x0);
@@ -240,16 +238,14 @@ int handleSnapping(TransInfo *t, wmEvent *event)
int status = 0;
#if 0 // XXX need a proper selector for all snap mode
- if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift)
- {
+ if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift) {
/* toggle snap and reinit */
t->settings->snap_flag ^= SCE_SNAP;
initSnapping(t, NULL);
status = 1;
}
#endif
- if (event->type == MOUSEMOVE)
- {
+ if (event->type == MOUSEMOVE) {
status |= updateSelectedSnapPoint(t);
}
@@ -259,8 +255,7 @@ int handleSnapping(TransInfo *t, wmEvent *event)
void applyProject(TransInfo *t)
{
/* XXX FLICKER IN OBJECT MODE */
- if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0)
- {
+ if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) {
TransData *td = t->data;
float tvec[3];
float imat[4][4];
@@ -283,8 +278,7 @@ void applyProject(TransInfo *t)
continue;
copy_v3_v3(iloc, td->loc);
- if (t->flag & (T_EDIT|T_POSE))
- {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob = t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, iloc);
}
@@ -296,8 +290,7 @@ void applyProject(TransInfo *t)
project_float(t->ar, iloc, mval);
- if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect))
- {
+ if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect)) {
// if (t->flag & (T_EDIT|T_POSE)) {
// mul_m4_v3(imat, loc);
// }
@@ -320,8 +313,7 @@ void applySnapping(TransInfo *t, float *vec)
if (t->tsnap.project)
return;
- if (t->tsnap.status & SNAP_FORCED)
- {
+ if (t->tsnap.status & SNAP_FORCED) {
t->tsnap.targetSnap(t);
t->tsnap.applySnap(t, vec);
@@ -331,15 +323,13 @@ void applySnapping(TransInfo *t, float *vec)
// Time base quirky code to go around findnearest slowness
/* !TODO! add exception for object mode, no need to slow it down then */
- if (current - t->tsnap.last >= 0.01)
- {
+ if (current - t->tsnap.last >= 0.01) {
t->tsnap.calcSnap(t, vec);
t->tsnap.targetSnap(t);
t->tsnap.last = current;
}
- if (validSnap(t))
- {
+ if (validSnap(t)) {
t->tsnap.applySnap(t, vec);
}
}
@@ -368,10 +358,8 @@ int usingSnappingNormal(TransInfo *t)
int validSnappingNormal(TransInfo *t)
{
- if (validSnap(t))
- {
- if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0)
- {
+ if (validSnap(t)) {
+ if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0) {
return 1;
}
}
@@ -439,38 +427,31 @@ void initSnapping(TransInfo *t, wmOperator *op)
resetSnapping(t);
/* if snap property exists */
- if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap"))
- {
- if (RNA_boolean_get(op->ptr, "snap"))
- {
+ if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) {
+ if (RNA_boolean_get(op->ptr, "snap")) {
t->modifiers |= MOD_SNAP;
- if (RNA_struct_property_is_set(op->ptr, "snap_target"))
- {
+ if (RNA_struct_property_is_set(op->ptr, "snap_target")) {
snap_target = RNA_enum_get(op->ptr, "snap_target");
}
- if (RNA_struct_property_is_set(op->ptr, "snap_point"))
- {
+ if (RNA_struct_property_is_set(op->ptr, "snap_point")) {
RNA_float_get_array(op->ptr, "snap_point", t->tsnap.snapPoint);
t->tsnap.status |= SNAP_FORCED|POINT_INIT;
}
/* snap align only defined in specific cases */
- if (RNA_struct_find_property(op->ptr, "snap_align"))
- {
+ if (RNA_struct_find_property(op->ptr, "snap_align")) {
t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align");
RNA_float_get_array(op->ptr, "snap_normal", t->tsnap.snapNormal);
normalize_v3(t->tsnap.snapNormal);
}
- if (RNA_struct_find_property(op->ptr, "use_snap_project"))
- {
+ if (RNA_struct_find_property(op->ptr, "use_snap_project")) {
t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project");
}
- if (RNA_struct_find_property(op->ptr, "use_snap_self"))
- {
+ if (RNA_struct_find_property(op->ptr, "use_snap_self")) {
t->tsnap.snap_self = RNA_boolean_get(op->ptr, "use_snap_self");
}
}
@@ -498,8 +479,7 @@ static void setSnappingCallback(TransInfo *t)
{
t->tsnap.calcSnap = CalcSnapGeometry;
- switch(t->tsnap.target)
- {
+ switch (t->tsnap.target) {
case SCE_SNAP_TARGET_CLOSEST:
t->tsnap.targetSnap = TargetSnapClosest;
break;
@@ -515,8 +495,7 @@ static void setSnappingCallback(TransInfo *t)
}
- switch (t->mode)
- {
+ switch (t->mode) {
case TFM_TRANSLATION:
t->tsnap.applySnap = ApplySnapTranslation;
t->tsnap.distance = TranslationBetween;
@@ -721,7 +700,7 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3])
mul_m3_v3(mtx, end);
mul_m3_v3(mtx, start);
- angle = atan2(start[1],start[0]) - atan2(end[1],end[0]);
+ angle = atan2(start[1], start[0]) - atan2(end[1], end[0]);
}
if (angle > (float)M_PI) {
@@ -766,8 +745,7 @@ static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec))
static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
{
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
float loc[3];
float no[3];
float mval[2];
@@ -777,8 +755,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
mval[0] = t->mval[0];
mval[1] = t->mval[1];
- if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME)
- {
+ if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) {
ListBase depth_peels;
DepthPeel *p1, *p2;
float *last_p = NULL;
@@ -799,10 +776,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
// }
- for (p1 = depth_peels.first; p1; p1 = p1->next)
- {
- if (p1->flag == 0)
- {
+ for (p1 = depth_peels.first; p1; p1 = p1->next) {
+ if (p1->flag == 0) {
float vec[3];
float new_dist;
@@ -810,13 +785,10 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
p1->flag = 1;
/* if peeling objects, take the first and last from each object */
- if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT)
- {
+ if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) {
DepthPeel *peel;
- for (peel = p1->next; peel; peel = peel->next)
- {
- if (peel->ob == p1->ob)
- {
+ for (peel = p1->next; peel; peel = peel->next) {
+ if (peel->ob == p1->ob) {
peel->flag = 1;
p2 = peel;
}
@@ -824,8 +796,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
}
/* otherwise, pair first with second and so on */
else {
- for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next)
- {
+ for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) {
/* nothing to do here */
}
}
@@ -839,9 +810,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
else {
copy_v3_v3(vec, p1->p);
}
-
- if (last_p == NULL)
- {
+
+ if (last_p == NULL) {
copy_v3_v3(p, vec);
max_dist = 0;
break;
@@ -856,8 +826,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
}
}
- if (max_dist != FLT_MAX)
- {
+ if (max_dist != FLT_MAX) {
copy_v3_v3(loc, p);
/* XXX, is there a correct normal in this case ???, for now just z up */
no[0]= 0.0;
@@ -878,8 +847,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
sub_v3_v3v3(tangent, loc, t->tsnap.snapPoint);
tangent[2] = 0;
- if (dot_v3v3(tangent, tangent) > 0)
- {
+ if (dot_v3v3(tangent, tangent) > 0) {
copy_v3_v3(t->tsnap.snapTangent, tangent);
}
@@ -899,8 +867,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
- if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
- {
+ if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint)) {
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
t->tsnap.snapPoint[0] *= aspx;
t->tsnap.snapPoint[1] *= aspy;
@@ -917,9 +884,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
static void TargetSnapCenter(TransInfo *t)
{
- // Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
+ /* Only need to calculate once */
+ if ((t->tsnap.status & TARGET_INIT) == 0) {
copy_v3_v3(t->tsnap.snapTarget, t->center);
if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
@@ -932,24 +898,20 @@ static void TargetSnapCenter(TransInfo *t)
static void TargetSnapActive(TransInfo *t)
{
- // Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
+ /* Only need to calculate once */
+ if ((t->tsnap.status & TARGET_INIT) == 0) {
TransData *td = NULL;
TransData *active_td = NULL;
int i;
- for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
- if (td->flag & TD_ACTIVE)
- {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
+ if (td->flag & TD_ACTIVE) {
active_td = td;
break;
}
}
- if (active_td)
- {
+ if (active_td) {
copy_v3_v3(t->tsnap.snapTarget, active_td->center);
if (t->flag & (T_EDIT|T_POSE)) {
@@ -971,8 +933,7 @@ static void TargetSnapActive(TransInfo *t)
static void TargetSnapMedian(TransInfo *t)
{
// Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
+ if ((t->tsnap.status & TARGET_INIT) == 0) {
TransData *td = NULL;
int i;
@@ -980,8 +941,7 @@ static void TargetSnapMedian(TransInfo *t)
t->tsnap.snapTarget[1] = 0;
t->tsnap.snapTarget[2] = 0;
- for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
add_v3_v3(t->tsnap.snapTarget, td->center);
}
@@ -999,21 +959,17 @@ static void TargetSnapMedian(TransInfo *t)
static void TargetSnapClosest(TransInfo *t)
{
// Only valid if a snap point has been selected
- if (t->tsnap.status & POINT_INIT)
- {
+ if (t->tsnap.status & POINT_INIT) {
TransData *closest = NULL, *td = NULL;
/* Object mode */
- if (t->flag & T_OBJECT)
- {
+ if (t->flag & T_OBJECT) {
int i;
- for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
struct BoundBox *bb = object_get_boundbox(td->ob);
/* use boundbox if possible */
- if (bb)
- {
+ if (bb) {
int j;
for (j = 0; j < 8; j++) {
@@ -1041,8 +997,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
- {
+ if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1065,8 +1020,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
- {
+ if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1101,9 +1055,9 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
copy_v3_v3(location, intersect);
if (v4co)
- normal_quad_v3( normal,v1co, v2co, v3co, v4co);
+ normal_quad_v3(normal, v1co, v2co, v3co, v4co);
else
- normal_tri_v3( normal,v1co, v2co, v3co);
+ normal_tri_v3(normal, v1co, v2co, v3co);
mul_m4_v3(obmat, location);
@@ -1112,8 +1066,7 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
- if (new_dist <= *dist && new_depth < *depth)
- {
+ if (new_dist <= *dist && new_depth < *depth) {
*depth = new_depth;
retval = 1;
@@ -1145,8 +1098,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
result = isect_line_line_v3(v1co, v2co, ray_start_local, ray_end, intersect, dvec); /* dvec used but we don't care about result */
- if (result)
- {
+ if (result) {
float edge_loc[3], vec[3];
float mul;
@@ -1167,8 +1119,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
copy_v3_v3(intersect, v2co);
}
- if (dot_v3v3(ray_normal_local, dvec) > 0)
- {
+ if (dot_v3v3(ray_normal_local, dvec) > 0) {
float location[3];
float new_depth;
int screen_loc[2];
@@ -1187,8 +1138,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
* this takes care of series of connected edges a bit slanted w.r.t the viewport
* otherwise, it would stick to the verts of the closest edge and not slide along merrily
* */
- if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f)
- {
+ if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f) {
float n1[3], n2[3];
*r_depth = new_depth;
@@ -1199,8 +1149,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
- if (r_no)
- {
+ if (r_no) {
normal_short_to_float_v3(n1, v1no);
normal_short_to_float_v3(n2, v2no);
interp_v3_v3v3(r_no, n2, n1, mul);
@@ -1227,8 +1176,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4],
sub_v3_v3v3(dvec, vco, ray_start_local);
- if (dot_v3v3(ray_normal_local, dvec) > 0)
- {
+ if (dot_v3v3(ray_normal_local, dvec) > 0) {
float location[3];
float new_depth;
int screen_loc[2];
@@ -1243,15 +1191,13 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4],
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
- if (new_dist <= *r_dist && new_depth < *r_depth)
- {
+ if (new_dist <= *r_dist && new_depth < *r_depth) {
*r_depth = new_depth;
retval = 1;
copy_v3_v3(r_loc, location);
- if (r_no)
- {
+ if (r_no) {
normal_short_to_float_v3(r_no, vno);
mul_m3_v3(timat, r_no);
normalize_v3(r_no);
@@ -1280,16 +1226,14 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
- if (arm->edbo)
- {
+ if (arm->edbo) {
EditBone *eBone;
for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
if (eBone->layer & arm->layer) {
/* skip hidden or moving (selected) bones */
if ((eBone->flag & (BONE_HIDDEN_A|BONE_ROOTSEL|BONE_TIPSEL))==0) {
- switch (snap_mode)
- {
+ switch (snap_mode) {
case SCE_SNAP_MODE_VERTEX:
retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
@@ -1313,8 +1257,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
float *head_vec = pchan->pose_head;
float *tail_vec = pchan->pose_tail;
- switch (snap_mode)
- {
+ switch (snap_mode) {
case SCE_SNAP_MODE_VERTEX:
retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
@@ -1366,8 +1309,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
if (test == 1) {
- switch (snap_mode)
- {
+ switch (snap_mode) {
case SCE_SNAP_MODE_FACE:
{
#ifdef USE_BVH_FACE_SNAP // Added for durian
@@ -1383,8 +1325,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
hit.index = -1;
hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
- if (treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
- {
+ if (treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) {
if (hit.dist/local_scale <= *r_depth) {
*r_depth= hit.dist/local_scale;
copy_v3_v3(r_loc, hit.co);
@@ -1409,8 +1350,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
int index = 0;
int i;
- if (em != NULL)
- {
+ if (em != NULL) {
index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
EDBM_index_arrays_init(em, 0, 0, 1);
}
@@ -1421,8 +1361,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
test = 1; /* reset for every face */
- if (em != NULL)
- {
+ if (em != NULL) {
if (index_array) {
index = index_array[i];
}
@@ -1436,8 +1375,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
else {
efa = EDBM_face_at_index(em, index);
- if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
- {
+ if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
test = 0;
}
else if (efa) {
@@ -1456,28 +1394,24 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
}
- if (test)
- {
+ if (test) {
int result;
float *v4co = NULL;
- if (f->v4)
- {
+ if (f->v4) {
v4co = verts[f->v4].co;
}
result = snapFace(ar, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, v4co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
retval |= result;
- if (f->v4 && result == 0)
- {
+ if (f->v4 && result == 0) {
retval |= snapFace(ar, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, verts[f->v2].co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
}
}
}
- if (em != NULL)
- {
+ if (em != NULL) {
EDBM_index_arrays_free(em);
}
#endif
@@ -1490,8 +1424,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
int index = 0;
int i;
- if (em != NULL)
- {
+ if (em != NULL) {
index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
EDBM_index_arrays_init(em, 1, 0, 0);
}
@@ -1516,22 +1449,19 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
else {
eve = EDBM_vert_at_index(em, index);
- if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT)))
- {
+ if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
test = 0;
}
}
}
- if (test)
- {
+ if (test) {
retval |= snapVertex(ar, v->co, v->no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
}
}
- if (em != NULL)
- {
+ if (em != NULL) {
EDBM_index_arrays_free(em);
}
break;
@@ -1545,8 +1475,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
int index = 0;
int i;
- if (em != NULL)
- {
+ if (em != NULL) {
index_array = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
EDBM_index_arrays_init(em, 0, 1, 0);
}
@@ -1557,8 +1486,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
test = 1; /* reset for every vert */
- if (em != NULL)
- {
+ if (em != NULL) {
if (index_array) {
index = index_array[i];
}
@@ -1580,16 +1508,13 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
}
}
}
-
-
- if (test)
- {
+
+ if (test) {
retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
}
}
- if (em != NULL)
- {
+ if (em != NULL) {
EDBM_index_arrays_free(em);
}
break;
@@ -1673,8 +1598,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
- {
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
Object *dob = dupli_ob->ob;
retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
@@ -1726,8 +1650,7 @@ static void removeDoublesPeel(ListBase *depth_peels)
{
DepthPeel *peel;
- for (peel = depth_peels->first; peel; peel = peel->next)
- {
+ for (peel = depth_peels->first; peel; peel = peel->next) {
DepthPeel *next_peel = peel->next;
if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) {
@@ -1815,9 +1738,9 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
copy_v3_v3(location, intersect);
if (f->v4)
- normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
+ normal_quad_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
else
- normal_tri_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
+ normal_tri_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
mul_m4_v3(obmat, location);
@@ -1844,13 +1767,13 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
copy_v3_v3(location, intersect);
if (f->v4)
- normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
+ normal_quad_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
else
- normal_tri_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
+ normal_tri_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
mul_m4_v3(obmat, location);
- new_depth = len_v3v3(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
mul_m3_v3(timat, normal);
normalize_v3(normal);
@@ -1881,8 +1804,7 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
- {
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
Object *dob = dupli_ob->ob;
if (dob->type == OB_MESH) {
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 4b03c846f3e..5430a9a1c90 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -187,75 +187,6 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
em->bm->elem_index_dirty |= BM_VERT;
MEM_freeN(vert_table);
-#if 0
- BMEditVert *eve, *prev;
- BMEditFace *efa;
- BMIter iter;
- float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
- intptr_t index = 0;
-
- /* two abused locations in vertices */
- for (eve = em->verts.first; eve; eve = eve->next, index++) {
- eve->tmp.p = NULL;
- eve->prev = (EditVert *)index;
- }
-
- /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
- for (efa = em->faces.first; efa; efa = efa->next) {
-
- /* retrieve mapped coordinates */
- v1 = mappedcos + 3 * (intptr_t)(efa->v1->prev);
- v2 = mappedcos + 3 * (intptr_t)(efa->v2->prev);
- v3 = mappedcos + 3 * (intptr_t)(efa->v3->prev);
-
- co1 = (origcos) ? origcos + 3 * (intptr_t)(efa->v1->prev) : efa->v1->co;
- co2 = (origcos) ? origcos + 3 * (intptr_t)(efa->v2->prev) : efa->v2->co;
- co3 = (origcos) ? origcos + 3 * (intptr_t)(efa->v3->prev) : efa->v3->co;
-
- if (efa->v2->tmp.p == NULL && efa->v2->f1) {
- set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
- efa->v2->tmp.p = (void *)quats;
- quats += 4;
- }
-
- if (efa->v4) {
- v4 = mappedcos + 3 * (intptr_t)(efa->v4->prev);
- co4 = (origcos) ? origcos + 3 * (intptr_t)(efa->v4->prev) : efa->v4->co;
-
- if (efa->v1->tmp.p == NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
- efa->v1->tmp.p = (void *)quats;
- quats += 4;
- }
- if (efa->v3->tmp.p == NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
- efa->v3->tmp.p = (void *)quats;
- quats += 4;
- }
- if (efa->v4->tmp.p == NULL && efa->v4->f1) {
- set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
- efa->v4->tmp.p = (void *)quats;
- quats += 4;
- }
- }
- else {
- if (efa->v1->tmp.p == NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
- efa->v1->tmp.p = (void *)quats;
- quats += 4;
- }
- if (efa->v3->tmp.p == NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
- efa->v3->tmp.p = (void *)quats;
- quats += 4;
- }
- }
- }
-
- /* restore abused prev pointer */
- for (prev = NULL, eve = em->verts.first; eve; prev = eve, eve = eve->next)
- eve->prev = prev;
-#endif
}
/* BMESH_TODO - use MPolys over MFace's */
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index c037508687b..1f1d5a0c0c0 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -207,8 +207,7 @@ char handleNumInput(NumInput *n, wmEvent *event)
if (n->flag & NUM_NO_FRACTION)
return 0;
- switch (n->ctrl[idx])
- {
+ switch (n->ctrl[idx]) {
case 0:
case 1:
n->ctrl[idx] = 10;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index a43d549cba1..cd88614f8fe 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -155,7 +155,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
ED_text_undo_step(C, step);
}
else if (obedit) {
- if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
+ if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
if (undoname)
undo_editmode_name(C, undoname);
else
@@ -247,7 +247,7 @@ int ED_undo_valid(const bContext *C, const char *undoname)
return 1;
}
else if (obedit) {
- if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
+ if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
return undo_editmode_valid(undoname);
}
}
@@ -413,9 +413,11 @@ void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int UNUSED(arg_ev
/* ************************** */
-#define UNDOSYSTEM_GLOBAL 1
-#define UNDOSYSTEM_EDITMODE 2
-#define UNDOSYSTEM_PARTICLE 3
+enum {
+ UNDOSYSTEM_GLOBAL = 1,
+ UNDOSYSTEM_EDITMODE = 2,
+ UNDOSYSTEM_PARTICLE = 3
+};
static int get_undo_system(bContext *C)
{
@@ -423,8 +425,9 @@ static int get_undo_system(bContext *C)
/* find out which undo system */
if (obedit) {
- if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
+ if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
return UNDOSYSTEM_EDITMODE;
+ }
}
else {
Object *obact = CTX_data_active_object(C);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index e772ff5a87a..fb7e2254e45 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -186,8 +186,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
BLI_array_empty(tf_uv);
BLI_array_empty(tf_uvorig);
- BLI_array_growitems(tf_uv, efa->len);
- BLI_array_growitems(tf_uvorig, efa->len);
+ BLI_array_grow_items(tf_uv, efa->len);
+ BLI_array_grow_items(tf_uvorig, efa->len);
i = 0;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -198,11 +198,11 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
i++;
}
- poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+ uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
totarea += BM_face_calc_area(efa);
//totuvarea += tf_area(tf, efa->v4!=0);
- totuvarea += poly_uv_area(tf_uv, efa->len);
+ totuvarea += uv_poly_area(tf_uv, efa->len);
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
@@ -236,8 +236,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
BLI_array_empty(tf_uv);
BLI_array_empty(tf_uvorig);
- BLI_array_growitems(tf_uv, efa->len);
- BLI_array_growitems(tf_uvorig, efa->len);
+ BLI_array_grow_items(tf_uv, efa->len);
+ BLI_array_grow_items(tf_uvorig, efa->len);
i = 0;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -248,10 +248,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
i++;
}
- poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+ uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
//uvarea = tf_area(tf, efa->v4!=0) / totuvarea;
- uvarea = poly_uv_area(tf_uv, efa->len) / totuvarea;
+ uvarea = uv_poly_area(tf_uv, efa->len) / totuvarea;
if (area < FLT_EPSILON || uvarea < FLT_EPSILON)
areadiff = 1.0f;
@@ -303,19 +303,19 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
BLI_array_empty(ang);
BLI_array_empty(av);
BLI_array_empty(auv);
- BLI_array_growitems(tf_uv, nverts);
- BLI_array_growitems(tf_uvorig, nverts);
- BLI_array_growitems(uvang, nverts);
- BLI_array_growitems(ang, nverts);
- BLI_array_growitems(av, nverts);
- BLI_array_growitems(auv, nverts);
+ BLI_array_grow_items(tf_uv, nverts);
+ BLI_array_grow_items(tf_uvorig, nverts);
+ BLI_array_grow_items(uvang, nverts);
+ BLI_array_grow_items(ang, nverts);
+ BLI_array_grow_items(av, nverts);
+ BLI_array_grow_items(auv, nverts);
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
copy_v2_v2(tf_uvorig[i], luv->uv);
}
- poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, nverts);
+ uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, nverts);
j = nverts - 1;
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
@@ -742,7 +742,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
continue;
if (!uvedit_face_select_test(scene, em, efa)) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
bglVertex2fv(cent);
}
}
@@ -757,7 +757,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
continue;
if (uvedit_face_select_test(scene, em, efa)) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
bglVertex2fv(cent);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index fdcb5db1911..d258d271833 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -54,14 +54,9 @@ struct BMVert;
int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
/* geometric utilities */
-
-void uv_center(float uv[][2], float cent[2], int quad);
-float uv_area(float uv[][2], int quad);
-void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy);
-
-float poly_uv_area(float uv[][2], int len);
-void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
-void poly_uv_center(struct BMEditMesh *em, struct BMFace *f, float cent[2]);
+float uv_poly_area(float uv[][2], int len);
+void uv_poly_copy_aspect(float uv_orig [][2], float uv[][2], float aspx, float aspy, int len);
+void uv_poly_center(struct BMEditMesh *em, struct BMFace *f, float r_cent[2]);
/* find nearest */
@@ -74,8 +69,10 @@ typedef struct NearestHit {
int vert1, vert2; //index in mesh of edge vertices
} NearestHit;
-void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], float penalty[2], struct NearestHit *hit);
-void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], struct NearestHit *hit);
+void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em,
+ const float co[2], const float penalty[2], struct NearestHit *hit);
+void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em,
+ const float co[2], struct NearestHit *hit);
/* utility tool functions */
@@ -120,4 +117,3 @@ void UV_OT_unwrap(struct wmOperatorType *ot);
void UV_OT_stitch(struct wmOperatorType *ot);
#endif /* __UVEDIT_INTERN_H__ */
-
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 1c62ce3a684..a30274c0f2c 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -47,6 +47,7 @@
#include "DNA_scene_types.h"
#include "BLI_math.h"
+#include "BLI_lasso.h"
#include "BLI_blenlib.h"
#include "BLI_array.h"
#include "BLI_utildefines.h"
@@ -522,44 +523,23 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
}
/*********************** geometric utilities ***********************/
-void poly_uv_center(BMEditMesh *em, BMFace *f, float cent[2])
+void uv_poly_center(BMEditMesh *em, BMFace *f, float r_cent[2])
{
BMLoop *l;
MLoopUV *luv;
BMIter liter;
- zero_v2(cent);
+ zero_v2(r_cent);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- add_v2_v2(cent, luv->uv);
+ add_v2_v2(r_cent, luv->uv);
}
- mul_v2_fl(cent, 1.0f / (float)f->len);
+ mul_v2_fl(r_cent, 1.0f / (float)f->len);
}
-
-void uv_center(float uv[][2], float cent[2], int quad)
-{
- if (quad) {
- cent[0] = (uv[0][0] + uv[1][0] + uv[2][0] + uv[3][0]) / 4.0f;
- cent[1] = (uv[0][1] + uv[1][1] + uv[2][1] + uv[3][1]) / 4.0f;
- }
- else {
- cent[0] = (uv[0][0] + uv[1][0] + uv[2][0]) / 3.0f;
- cent[1] = (uv[0][1] + uv[1][1] + uv[2][1]) / 3.0f;
- }
-}
-
-float uv_area(float uv[][2], int quad)
-{
- if (quad)
- return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]);
- else
- return area_tri_v2(uv[0], uv[1], uv[2]);
-}
-
-float poly_uv_area(float uv[][2], int len)
+float uv_poly_area(float uv[][2], int len)
{
//BMESH_TODO: make this not suck
//maybe use scanfill? I dunno.
@@ -572,7 +552,7 @@ float poly_uv_area(float uv[][2], int len)
return 1.0;
}
-void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
+void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
{
int i;
for (i = 0; i < len; i++) {
@@ -581,7 +561,7 @@ void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy,
}
}
-int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float *max)
+int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], float r_max[2])
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -591,7 +571,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float
MLoopUV *luv;
int sel;
- INIT_MINMAX2(min, max);
+ INIT_MINMAX2(r_min, r_max);
sel = 0;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -602,7 +582,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(em, scene, l)) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- DO_MINMAX2(luv->uv, min, max);
+ DO_MINMAX2(luv->uv, r_min, r_max);
sel = 1;
}
}
@@ -663,7 +643,7 @@ static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2]
/************************** find nearest ****************************/
-void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
+void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
@@ -710,13 +690,11 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2],
}
}
-static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
+static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
- BMLoop *l;
- BMIter iter, liter;
- MLoopUV *luv;
+ BMIter iter;
float mindist, dist, cent[2];
mindist = 1e10f;
@@ -731,16 +709,9 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
if (!uvedit_face_visible_test(scene, ima, efa, tf))
continue;
-
- cent[0] = cent[1] = 0.0f;
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- add_v2_v2(cent, luv->uv);
- }
+ uv_poly_center(em, efa, cent);
- cent[0] /= efa->len;
- cent[1] /= efa->len;
dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
if (dist < mindist) {
@@ -752,7 +723,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float
}
static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id,
- float co[2], float uv[2])
+ const float co[2], const float uv[2])
{
BMLoop *l;
MLoopUV *luv;
@@ -798,7 +769,7 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i
}
void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
- float co[2], float penalty[2], NearestHit *hit)
+ float const co[2], const float penalty[2], NearestHit *hit)
{
BMFace *efa;
BMLoop *l;
@@ -856,7 +827,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
}
}
-int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
+int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float co[2], float r_uv[2])
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -865,11 +836,10 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2],
MTexPoly *tf;
MLoopUV *luv;
float mindist, dist;
- int found = 0;
+ int found = FALSE;
mindist = 1e10f;
- uv[0] = co[0];
- uv[1] = co[1];
+ copy_v2_v2(r_uv, co);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
@@ -883,9 +853,8 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2],
if (dist <= mindist) {
mindist = dist;
- uv[0] = luv->uv[0];
- uv[1] = luv->uv[1];
- found = 1;
+ copy_v2_v2(r_uv, luv->uv);
+ found = TRUE;
}
}
}
@@ -1105,7 +1074,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
/*********************** linked select ***********************/
-static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[2], NearestHit *hit, int extend)
+static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, int extend)
{
BMFace *efa;
BMLoop *l;
@@ -1716,11 +1685,11 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa
return 0;
}
-static int mouse_select(bContext *C, float co[2], int extend, int loop)
+static int mouse_select(bContext *C, const float co[2], int extend, int loop)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1787,8 +1756,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* mark 1 vertex as being hit */
- BLI_array_growitems(hitv, hit.efa->len);
- BLI_array_growitems(hituv, hit.efa->len);
+ BLI_array_grow_items(hitv, hit.efa->len);
+ BLI_array_grow_items(hituv, hit.efa->len);
for (i = 0; i < hit.efa->len; i++) {
hitv[i] = 0xFFFFFFFF;
}
@@ -1808,8 +1777,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* mark 2 edge vertices as being hit */
- BLI_array_growitems(hitv, hit.efa->len);
- BLI_array_growitems(hituv, hit.efa->len);
+ BLI_array_grow_items(hitv, hit.efa->len);
+ BLI_array_grow_items(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = hit.vert1;
@@ -1833,8 +1802,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
/* mark all face vertices as being hit */
- BLI_array_growitems(hitv, hit.efa->len);
- BLI_array_growitems(hituv, hit.efa->len);
+ BLI_array_grow_items(hitv, hit.efa->len);
+ BLI_array_grow_items(hituv, hit.efa->len);
i = 0;
BM_ITER_ELEM (l, &liter, hit.efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -2122,7 +2091,7 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2224,7 +2193,7 @@ static void UV_OT_select_linked_pick(wmOperatorType *ot)
static int unlink_selection_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2282,6 +2251,25 @@ static void UV_OT_unlink_selected(wmOperatorType *ot)
ot->poll = ED_operator_uvedit;
}
+static void uv_select_sync_flush(ToolSettings *ts, BMEditMesh *em, const short select)
+{
+ /* bmesh API handles flushing but not on de-select */
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode != SCE_SELECT_FACE) {
+ if (select == FALSE) {
+ EDBM_deselect_flush(em);
+ }
+ else {
+ EDBM_select_flush(em);
+ }
+ }
+
+ if (select == FALSE) {
+ BM_select_history_validate(em->bm);
+ }
+ }
+}
+
/* ******************** border select operator **************** */
/* This function sets the selection on tagged faces, need because settings the
@@ -2291,7 +2279,7 @@ static void UV_OT_unlink_selected(wmOperatorType *ot)
*
* De-selects faces that have been tagged on efa->tmp.l. */
-static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, short select)
+static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, short select)
{
/* Selecting UV Faces with some modes requires us to change
* the selection in other faces (depending on the sticky mode).
@@ -2299,7 +2287,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
* This only needs to be done when the Mesh is not used for
* selection (so for sticky modes, vertex or location based). */
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -2420,7 +2408,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
ARegion *ar = CTX_wm_region(C);
@@ -2469,7 +2457,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = 1;
@@ -2479,7 +2467,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
/* (de)selects all tagged faces and deals with sticky modes */
if (change)
- uv_faces_do_sticky(C, sima, scene, obedit, select);
+ uv_faces_do_sticky(sima, scene, obedit, select);
}
else {
/* other selection modes */
@@ -2512,22 +2500,11 @@ static int border_select_exec(bContext *C, wmOperator *op)
}
if (change) {
- /* bmesh API habdles flushing but not on de-select */
- if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode != SCE_SELECT_FACE) {
- if (select == FALSE) {
- EDBM_deselect_flush(em);
- }
- }
- }
+ uv_select_sync_flush(ts, em, select);
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (select == FALSE) {
- BM_select_history_validate(em->bm);
- }
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
-
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2560,13 +2537,12 @@ static void UV_OT_select_border(wmOperatorType *ot)
/* ******************** circle select operator **************** */
-static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
- float *offset, float *ell, BMLoop *l, MLoopUV *luv)
+static int select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
+ float *offset, float *ell, BMLoop *l, MLoopUV *luv)
{
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
float x, y, r2, *uv;
-
-
+
uv = luv->uv;
x = (uv[0] - offset[0]) * ell[0];
@@ -2575,7 +2551,11 @@ static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), S
r2 = x * x + y * y;
if (r2 < 1.0f) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
- else uvedit_uv_select_disable(em, scene, l);
+ else uvedit_uv_select_disable(em, scene, l);
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
}
@@ -2583,6 +2563,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
ARegion *ar = CTX_wm_region(C);
@@ -2593,6 +2574,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
int x, y, radius, width, height, select;
float zoomx, zoomy, offset[2], ellipse[2];
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
+ int change = FALSE;
/* get operator properties */
select = (gesture_mode == GESTURE_MODAL_SELECT);
@@ -2614,15 +2596,17 @@ static int circle_select_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
+ change |= select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
}
}
-#if 0 //I think the BM_elem_select_set api stuff handles all this as necessary?
- if (select) EM_select_flush(em);
- else EM_deselect_flush(em);
-#endif
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ if (change) {
+ uv_select_sync_flush(ts, em, select);
+
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ }
+ }
return OPERATOR_FINISHED;
}
@@ -2651,9 +2635,129 @@ static void UV_OT_circle_select(wmOperatorType *ot)
RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
}
+
+/* ******************** lasso select operator **************** */
+
+static void do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, short select)
+{
+ Image *ima = CTX_data_edit_image(C);
+ ARegion *ar = CTX_wm_region(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+
+ BMIter iter, liter;
+
+ BMFace *efa;
+ BMLoop *l;
+ MTexPoly *tf;
+ int screen_uv[2], change = TRUE;
+ rcti rect;
+
+ BLI_lasso_boundbox(&rect, mcords, moves);
+
+ if (ts->uv_selectmode == UV_SELECT_FACE) { /* Face Center Sel */
+ change = FALSE;
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ /* assume not touched */
+ if ((select) != (uvedit_face_select_test(scene, em, efa))) {
+ float cent[2];
+ uv_poly_center(em, efa, cent);
+ UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]);
+ if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
+ BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
+ {
+ uvedit_face_select_enable(scene, em, efa, FALSE);
+ change = TRUE;
+ }
+ }
+ }
+ }
+ else { /* Vert Sel */
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+ if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+ BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+ if ((select) != (uvedit_uv_select_test(em, scene, l))) {
+ MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+ UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]);
+ if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
+ BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
+ {
+ if (select) {
+ uvedit_uv_select_enable(em, scene, l, FALSE);
+ }
+ else {
+ uvedit_uv_select_disable(em, scene, l);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (change) {
+ uv_select_sync_flush(scene->toolsettings, em, select);
+
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ }
+ }
+}
+
+static int uv_lasso_select_exec(bContext *C, wmOperator *op)
+{
+ int i = 0;
+ int mcords[1024][2];
+
+ RNA_BEGIN (op->ptr, itemptr, "path") {
+ float loc[2];
+
+ RNA_float_get_array(&itemptr, "loc", loc);
+ mcords[i][0] = (int)loc[0];
+ mcords[i][1] = (int)loc[1];
+ i++;
+ if (i >= 1024) break;
+ }
+ RNA_END;
+
+ if (i > 1) {
+ short select;
+
+ select = !RNA_boolean_get(op->ptr, "deselect");
+ do_lasso_select_mesh_uv(C, mcords, i, select);
+
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_PASS_THROUGH;
+}
+
+void UV_OT_select_lasso(wmOperatorType *ot)
+{
+ ot->name = "Lasso Select UV";
+ ot->description = "Select UVs using lasso selection";
+ ot->idname = "UV_OT_select_lasso";
+
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = uv_lasso_select_exec;
+ ot->poll = ED_operator_image_active;
+ ot->cancel = WM_gesture_lasso_cancel;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+
+ RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
+ RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+}
+
+
+
/* ******************** snap cursor operator **************** */
-static void snap_uv_to_pixel(float *uvco, float w, float h)
+static void snap_uv_to_pixel(float uvco[2], float w, float h)
{
uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w;
uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h;
@@ -3018,9 +3122,9 @@ static int bm_face_is_all_uv_sel(BMesh *bm, BMFace *f, int bool_test)
static int hide_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -3133,9 +3237,9 @@ static void UV_OT_hide(wmOperatorType *ot)
static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima = CTX_wm_space_image(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
- /*Scene *scene = CTX_data_scene(C);*/ /*UNUSED*/
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -3561,6 +3665,7 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_unlink_selected);
WM_operatortype_append(UV_OT_select_pinned);
WM_operatortype_append(UV_OT_select_border);
+ WM_operatortype_append(UV_OT_select_lasso);
WM_operatortype_append(UV_OT_circle_select);
WM_operatortype_append(UV_OT_snap_cursor);
@@ -3621,6 +3726,11 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "UV_OT_circle_select", CKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "UV_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ kmi = WM_keymap_add_item(keymap, "UV_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "deselect", TRUE);
+
/* selection manipulation */
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0)->ptr, "extend", FALSE);
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0)->ptr, "extend", FALSE);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 36b1e77e5e5..e1b2d87c4f2 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1162,7 +1162,7 @@ static int stitch_init(bContext *C, wmOperator *op)
EDBM_index_arrays_init(em, 0, 0, 1);
- RNA_BEGIN(op->ptr, itemptr, "selection") {
+ RNA_BEGIN (op->ptr, itemptr, "selection") {
faceIndex = RNA_int_get(&itemptr, "face_index");
elementIndex = RNA_int_get(&itemptr, "element_index");
efa = EDBM_face_at_index(em, faceIndex);