diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-17 06:41:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-17 06:41:53 +0400 |
commit | 5c6ee6b523c6a53c310683a9f7fbe5d730db6122 (patch) | |
tree | 65e90096612cac887a47ef19d27551e2e0b1cac1 /source/blender/editors | |
parent | db6cb30941da7899ccafa44c87c17970d134a2c9 (diff) | |
parent | 994f4bb3f78a467b6c34e30a9b8868fc4d01caf0 (diff) |
svn merge ^/trunk/blender -r42670:42680
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 18 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_navmesh.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 37 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 4 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 7 | ||||
-rw-r--r-- | source/blender/editors/sound/sound_ops.c | 198 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 30 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 36 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 12 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 33 |
14 files changed, 234 insertions, 162 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index f3a99ecf6b8..7dd07db9b30 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -389,17 +389,7 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) glEnable( GL_BLEND ); } - /* solid part */ - uiDrawBox(GL_POLYGON, minx, miny, maxx, maxy, rad); - - /* set antialias line */ - glEnable( GL_LINE_SMOOTH ); - glEnable( GL_BLEND ); - - uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); - - glDisable( GL_BLEND ); - glDisable( GL_LINE_SMOOTH ); + ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index d6460f9046e..e4cc605e3f5 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -462,6 +462,7 @@ extern int ui_button_is_active(struct ARegion *ar); /* interface_widgets.c */ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); +void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad); void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect); int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 9a438070e1e..0da4d3895e0 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -200,7 +200,25 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_BLEND); +} + +void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad) +{ + float color[4]; + int j; + + glEnable(GL_BLEND); + glGetFloatv(GL_CURRENT_COLOR, color); + color[3] *= 0.125f; + glColor4fv(color); + for(j=0; j<8; j++) { + glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); + uiDrawBox(mode, minx, miny, maxx, maxy, rad); + glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); + } + + glDisable(GL_BLEND); } static void widget_init(uiWidgetBase *wtb) diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index bb96fe25ffd..5eb1fd234e4 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -529,7 +529,8 @@ void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int compare(const void * a, const void * b){ +static int compare(const void * a, const void * b) +{ return ( *(int*)a - *(int*)b ); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 4db6e4ece54..438d04ba69b 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -47,9 +47,10 @@ #include "DNA_speaker_types.h" #include "DNA_vfont_types.h" +#include "BLI_ghash.h" +#include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_string.h" -#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_anim.h" @@ -1052,11 +1053,17 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, { ListBase *lb; DupliObject *dob; - + GHash *dupli_gh= NULL, *parent_gh= NULL; + if(!(base->object->transflag & OB_DUPLI)) return; 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"); + } for(dob= lb->first; dob; dob= dob->next) { Base *basen; @@ -1085,6 +1092,11 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, copy_m4_m4(ob->obmat, dob->mat); object_apply_mat4(ob, ob->obmat, FALSE, FALSE); + + if(dupli_gh) + BLI_ghash_insert(dupli_gh, dob, ob); + if(parent_gh) + BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, dob->index), ob); } if (use_hierarchy) { @@ -1093,12 +1105,17 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, Object *ob_src= dob->ob; Object *ob_src_par= ob_src->parent; - Object *ob_dst= (Object *)ob_src->id.newid; + Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob); + Object *ob_dst_par= NULL; - if (ob_src_par && ob_src_par->id.newid) { - /* the parent was also made real, parent newly real duplis */ - Object *ob_dst_par= (Object *)ob_src_par->id.newid; + /* find parent that was also made real */ + if(ob_src_par) { + GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, dob->index); + ob_dst_par = BLI_ghash_lookup(parent_gh, pair); + BLI_ghashutil_pairfree(pair); + } + if (ob_dst_par) { /* allow for all possible parent types */ ob_dst->partype= ob_src->partype; BLI_strncpy(ob_dst->parsubstr, ob_src->parsubstr, sizeof(ob_dst->parsubstr)); @@ -1132,8 +1149,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, * base object */ for(dob= lb->first; dob; dob= dob->next) { /* original parents */ - Object *ob_src= dob->ob; - Object *ob_dst= (Object *)ob_src->id.newid; + Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob); ob_dst->parent= base->object; ob_dst->partype= PAROBJECT; @@ -1147,6 +1163,11 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, } } + if(dupli_gh) + BLI_ghash_free(dupli_gh, NULL, NULL); + if(parent_gh) + BLI_ghash_free(parent_gh, BLI_ghashutil_pairfree, NULL); + copy_object_set_idnew(C, 0); free_object_duplilist(lb); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 5930e66e9fe..4020d6923e4 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2605,8 +2605,8 @@ static int set_active_group_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; int nr= RNA_enum_get(op->ptr, "group"); + BLI_assert(nr+1 >= 0); ob->actdef= nr+1; - BLI_assert(ob->actdef >= 0); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob); @@ -2740,8 +2740,8 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op) 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]; - BLI_assert(ob->actdef >= 0); MEM_freeN(sort_map_update); diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 0cecfa05b49..62e0e5e201d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -59,7 +59,8 @@ #include "physics_intern.h" -static int cache_break_test(void *UNUSED(cbd)) { +static int cache_break_test(void *UNUSED(cbd)) +{ return G.afbreek==1; } static int ptcache_bake_all_poll(bContext *C) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 69c6092b27b..23e937e3d71 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1103,8 +1103,8 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op) ViewContext vc; view3d_set_viewcontext(C, &vc); + BLI_assert(type + 1 >= 0); vc.obact->actdef= type + 1; - BLI_assert(vc.obact->actdef >= 0); DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact); @@ -1998,8 +1998,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */ } else { - ob->actdef= 1 + BLI_findindex(&ob->defbase, dg); - BLI_assert(ob->actdef >= 0); + int actdef = 1 + BLI_findindex(&ob->defbase, dg); + BLI_assert(actdef >= 0); + ob->actdef= actdef; } } } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index dd7ea81d520..8eb1f08b5b0 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -212,6 +212,104 @@ static void SOUND_OT_open_mono(wmOperatorType *ot) RNA_def_boolean(ot->srna, "mono", TRUE, "Mono", "Mixdown the sound to mono"); } +/* ******************************************************* */ + +static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Sequence* seq; + Scene* scene = CTX_data_scene(C); + struct FCurve* fcu; + char driven; + + 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; + else + seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED; + + fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pitch", 0, &driven); + if(fcu || driven) + seq->flag |= SEQ_AUDIO_PITCH_ANIMATED; + else + seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED; + + fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pan", 0, &driven); + if(fcu || driven) + seq->flag |= SEQ_AUDIO_PAN_ANIMATED; + else + seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED; + } + SEQ_END + + fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven); + if(fcu || driven) + scene->audio.flag |= AUDIO_VOLUME_ANIMATED; + else + scene->audio.flag &= ~AUDIO_VOLUME_ANIMATED; + + return OPERATOR_FINISHED; +} + +static void SOUND_OT_update_animation_flags(wmOperatorType *ot) +{ + /* + This operator is needed to set a correct state of the sound animation + System. Unfortunately there's no really correct place to call the exec + function, that's why I made it an operator that's only visible in the + search menu. Apart from that the bake animation operator calls it too. + */ + + /* identifiers */ + ot->name= "Update animation"; + ot->description= "Update animation flags"; + ot->idname= "SOUND_OT_update_animation_flags"; + + /* api callbacks */ + ot->exec= sound_update_animation_flags_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER; +} + +/* ******************************************************* */ + +static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Main* bmain = CTX_data_main(C); + Scene* scene = CTX_data_scene(C); + int oldfra = scene->r.cfra; + int cfra; + + sound_update_animation_flags_exec(C, NULL); + + for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++) + { + scene->r.cfra = cfra; + scene_update_for_newframe(bmain, scene, scene->lay); + } + + scene->r.cfra = oldfra; + scene_update_for_newframe(bmain, scene, scene->lay); + + return OPERATOR_FINISHED; +} + +static void SOUND_OT_bake_animation(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Update animation cache"; + ot->description= "Updates the audio animation cache so that it's up to date"; + ot->idname= "SOUND_OT_bake_animation"; + + /* api callbacks */ + ot->exec= sound_bake_animation_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER; +} + + /******************** mixdown operator ********************/ static int sound_mixdown_exec(bContext *C, wmOperator *op) @@ -228,6 +326,8 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) AUD_Codec codec; const char* result; + sound_bake_animation_exec(C, op); + RNA_string_get(op->ptr, "filepath", path); bitrate = RNA_int_get(op->ptr, "bitrate") * 1000; accuracy = RNA_int_get(op->ptr, "accuracy"); @@ -615,104 +715,6 @@ static void SOUND_OT_unpack(wmOperatorType *ot) /* ******************************************************* */ -static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Sequence* seq; - Scene* scene = CTX_data_scene(C); - struct FCurve* fcu; - char driven; - - 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; - else - seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED; - - fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pitch", 0, &driven); - if(fcu || driven) - seq->flag |= SEQ_AUDIO_PITCH_ANIMATED; - else - seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED; - - fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pan", 0, &driven); - if(fcu || driven) - seq->flag |= SEQ_AUDIO_PAN_ANIMATED; - else - seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED; - } - SEQ_END - - fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven); - if(fcu || driven) - scene->audio.flag |= AUDIO_VOLUME_ANIMATED; - else - scene->audio.flag &= ~AUDIO_VOLUME_ANIMATED; - - return OPERATOR_FINISHED; -} - -static void SOUND_OT_update_animation_flags(wmOperatorType *ot) -{ - /* - This operator is needed to set a correct state of the sound animation - System. Unfortunately there's no really correct place to call the exec - function, that's why I made it an operator that's only visible in the - search menu. Apart from that the bake animation operator calls it too. - */ - - /* identifiers */ - ot->name= "Update animation"; - ot->description= "Update animation flags"; - ot->idname= "SOUND_OT_update_animation_flags"; - - /* api callbacks */ - ot->exec= sound_update_animation_flags_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER; -} - -/* ******************************************************* */ - -static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Main* bmain = CTX_data_main(C); - Scene* scene = CTX_data_scene(C); - int oldfra = scene->r.cfra; - int cfra; - - sound_update_animation_flags_exec(C, NULL); - - for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++) - { - scene->r.cfra = cfra; - scene_update_for_newframe(bmain, scene, scene->lay); - } - - scene->r.cfra = oldfra; - scene_update_for_newframe(bmain, scene, scene->lay); - - return OPERATOR_FINISHED; -} - -static void SOUND_OT_bake_animation(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Update animation cache"; - ot->description= "Updates the audio animation cache so that it's up to date"; - ot->idname= "SOUND_OT_bake_animation"; - - /* api callbacks */ - ot->exec= sound_bake_animation_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER; -} - - -/* ******************************************************* */ - void ED_operatortypes_sound(void) { WM_operatortype_append(SOUND_OT_open); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 89547edaafa..e728267f45f 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -396,8 +396,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement * /* id in tselem is object */ ob= (Object *)tselem->id; if(set) { + BLI_assert(te->index+1 >= 0); ob->actdef= te->index+1; - BLI_assert(ob->actdef >= 0); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 992fe921dbf..a0c39eaa3c6 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -380,7 +380,8 @@ static void viewRedrawPost(bContext *C, TransInfo *t) /* ************************** TRANSFORMATIONS **************************** */ -void BIF_selectOrientation(void) { +void BIF_selectOrientation(void) +{ #if 0 // TRANSFORM_FIX_ME short val; char *str_menu = BIF_menustringTransformOrientation("Orientation"); @@ -2551,7 +2552,8 @@ void initResize(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerResize(TransInfo *t, float vec[3], char *str) { +static void headerResize(TransInfo *t, float vec[3], char *str) +{ char tvec[60]; char *spos= str; if (hasNumInput(&t->num)) { @@ -2611,7 +2613,8 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size) } -static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { +static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) +{ float tmat[3][3], smat[3][3], center[3]; float vec[3]; @@ -2908,7 +2911,8 @@ void initRotation(TransInfo *t) copy_v3_v3(t->axis_orig, t->axis); } -static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) { +static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) +{ float vec[3], totmat[3][3], smat[3][3]; float eul[3], fmat[3][3], quat[4]; float *center = t->center; @@ -3348,7 +3352,8 @@ void initTranslation(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerTranslation(TransInfo *t, float vec[3], char *str) { +static void headerTranslation(TransInfo *t, float vec[3], char *str) +{ char *spos= str; char tvec[60]; char distvec[20]; @@ -3422,7 +3427,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { (void)spos; } -static void applyTranslation(TransInfo *t, float vec[3]) { +static void applyTranslation(TransInfo *t, float vec[3]) +{ TransData *td = t->data; float tvec[3]; int i; @@ -4104,7 +4110,8 @@ void initBoneSize(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerBoneSize(TransInfo *t, float vec[3], char *str) { +static void headerBoneSize(TransInfo *t, float vec[3], char *str) +{ char tvec[60]; if (hasNumInput(&t->num)) { outputNumInput(&(t->num), tvec); @@ -5194,7 +5201,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str) sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text); } -static void applySeqSlide(TransInfo *t, float val[2]) { +static void applySeqSlide(TransInfo *t, float val[2]) +{ TransData *td = t->data; int i; @@ -5718,7 +5726,8 @@ void initTimeScale(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerTimeScale(TransInfo *t, char *str) { +static void headerTimeScale(TransInfo *t, char *str) +{ char tvec[60]; if (hasNumInput(&t->num)) @@ -5729,7 +5738,8 @@ static void headerTimeScale(TransInfo *t, char *str) { sprintf(str, "ScaleX: %s", &tvec[0]); } -static void applyTimeScale(TransInfo *t) { +static void applyTimeScale(TransInfo *t) +{ Scene *scene = t->scene; TransData *td = t->data; TransData2D *td2d = t->data2d; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index bfb96149ed3..b88e57e1861 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -138,7 +138,8 @@ void constraintNumInput(TransInfo *t, float vec[3]) } } -static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) { +static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) +{ int i = 0; mul_m3_v3(t->con.imtx, vec); @@ -209,7 +210,8 @@ static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3]) } } -static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) { +static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) +{ float norm[3], vec[3], factor, angle; float t_con_center[3]; @@ -284,7 +286,8 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 } } -static void planeProjection(TransInfo *t, float in[3], float out[3]) { +static void planeProjection(TransInfo *t, float in[3], float out[3]) +{ float vec[3], factor, norm[3]; add_v3_v3v3(vec, in, t->con.center); @@ -547,7 +550,8 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], /*--------------------- INTERNAL SETUP CALLS ------------------*/ -void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) { +void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) +{ strncpy(t->con.text + 1, text, 48); copy_m3_m3(t->con.mtx, space); t->con.mode = mode; @@ -562,7 +566,8 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) t->redraw = 1; } -void setLocalConstraint(TransInfo *t, int mode, const char text[]) { +void setLocalConstraint(TransInfo *t, int mode, const char text[]) +{ if (t->flag & T_EDIT) { float obmat[3][3]; copy_m3_m4(obmat, t->scene->obedit->obmat); @@ -596,7 +601,8 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) { ftext is a format string passed to sprintf. It will add the name of the orientation where %s is (logically). */ -void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) { +void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) +{ char text[40]; switch(orientation) { @@ -744,7 +750,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) } } -static void drawObjectConstraint(TransInfo *t) { +static void drawObjectConstraint(TransInfo *t) +{ int i; TransData * td = t->data; @@ -781,13 +788,15 @@ static void drawObjectConstraint(TransInfo *t) { /*--------------------- START / STOP CONSTRAINTS ---------------------- */ -void startConstraint(TransInfo *t) { +void startConstraint(TransInfo *t) +{ t->con.mode |= CON_APPLY; *t->con.text = ' '; t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max); } -void stopConstraint(TransInfo *t) { +void stopConstraint(TransInfo *t) +{ t->con.mode &= ~(CON_APPLY|CON_SELECT); *t->con.text = '\0'; t->num.idx_max = t->idx_max; @@ -836,7 +845,8 @@ void initSelectConstraint(TransInfo *t, float mtx[3][3]) t->con.applyRot = applyAxisConstraintRot; } -void selectConstraint(TransInfo *t) { +void selectConstraint(TransInfo *t) +{ if (t->con.mode & CON_SELECT) { setNearestAxis(t); startConstraint(t); @@ -970,7 +980,8 @@ void setNearestAxis(TransInfo *t) /*-------------- HELPER FUNCTIONS ----------------*/ -char constraintModeToChar(TransInfo *t) { +char constraintModeToChar(TransInfo *t) +{ if ((t->con.mode & CON_APPLY)==0) { return '\0'; } @@ -990,7 +1001,8 @@ char constraintModeToChar(TransInfo *t) { } -int isLockConstraint(TransInfo *t) { +int isLockConstraint(TransInfo *t) +{ int mode = t->con.mode; if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1)) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1c1725b20b9..4a7793b9e4a 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -122,7 +122,8 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list); /* ************************** Functions *************************** */ -static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) { +static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) +{ TransData *ihead = head; TransData *itail = tail; *temp = *head; @@ -169,7 +170,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra } } -void sort_trans_data_dist(TransInfo *t) { +void sort_trans_data_dist(TransInfo *t) +{ TransData temp; TransData *start = t->data; int i = 1; @@ -1334,7 +1336,8 @@ static void createTransMBallVerts(TransInfo *t) /* ********************* curve/surface ********* */ -static void calc_distanceCurveVerts(TransData *head, TransData *tail) { +static void calc_distanceCurveVerts(TransData *head, TransData *tail) +{ TransData *td, *td_near = NULL; for (td = head; td<=tail; td++) { if (td->flag & TD_SELECTED) { @@ -1379,7 +1382,8 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) { } /* Utility function for getting the handle data from bezier's */ -static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) { +static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) +{ TransDataCurveHandleFlags *hdata; td->flag |= TD_BEZTRIPLE; hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data"); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 174f8d00c00..0fa38e016ed 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -128,7 +128,8 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name } } -TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) { +TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) +{ Base *base = CTX_data_active_base(C); Object *ob; float mat[3][3]; @@ -151,7 +152,8 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports) return addMatrixSpace(C, mat, name, overwrite); } -TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ float mat[3][3]; float normal[3], plane[3]; @@ -170,7 +172,8 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na return addMatrixSpace(C, mat, name, overwrite); } -TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ float mat[3][3]; float normal[3], plane[3]; int type; @@ -268,7 +271,8 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]) return 1; } -TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) { +TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts = NULL; @@ -295,7 +299,8 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], return ts; } -void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { +void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int i; @@ -322,7 +327,8 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { } } -void BIF_removeTransformOrientationIndex(bContext *C, int index) { +void BIF_removeTransformOrientationIndex(bContext *C, int index) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts= BLI_findlink(transform_spaces, index); @@ -345,7 +351,8 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index) { } } -void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) { +void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; View3D *v3d = CTX_wm_view3d(C); TransformOrientation *ts; @@ -359,7 +366,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) { } } -void BIF_selectTransformOrientationValue(bContext *C, int orientation) { +void BIF_selectTransformOrientationValue(bContext *C, int orientation) +{ View3D *v3d = CTX_wm_view3d(C); if(v3d) /* currently using generic poll */ v3d->twmode = orientation; @@ -408,7 +416,8 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) return item; } -const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) { +const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) +{ const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; @@ -430,7 +439,8 @@ const char * BIF_menustringTransformOrientation(const bContext *C, const char *t return str_menu; } -int BIF_countTransformOrientation(const bContext *C) { +int BIF_countTransformOrientation(const bContext *C) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int count = 0; @@ -442,7 +452,8 @@ int BIF_countTransformOrientation(const bContext *C) { return count; } -void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) { +void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) +{ TransformOrientation *ts; View3D *v3d = CTX_wm_view3d(C); int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); |