Debian Codegraph @

misc/cfg/cams.cfg

raw
1 //
2 // Camera positions bookmarks 1.2
3 //
4 // Use [Ctrl]+[0], [1], ..., [9] to store cam positions
5 // Use [0], [1], ..., [9] to load stored camera positions
6 // Use [Shift]+[0], [1], ..., [9] to move smoothly to cam position
7 // (will happen only during capturing)
8 //
9
10 // -- settings --
11 set cams_moveframes 50 // duration - how many frames will the movement take
12 // note: you set time here, not the distance nor the speed. distance is given by the two points of the movement, speed is given as distance/time (frames)
13
14 bind ctrl +cams_save_mode
15 bind shift +cams_move_mode
16
17
18 // -- print info --
19 echo "$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-"
20 echo "Camera bookmarks config"
21 echo "$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-$-"
22 echo "Use $[ctrl$]+$[num$] to save camera position, $[num$] to load it"
23 echo "Use $[shift$]+$[num$] to start camera movement to camera positions 1, 2, ..., num"
24
25 // -- code -- (don't touch this)
26
27 set cams_bindn 0
28 // in other words: for (i=0; i<10; i++) { bind i cams_go i }
29 alias cams_bindnext "cams_bindc; inc cams_bindn 1; if $cams_bindn < 10 cams_bindnext"
30 alias cams_bindc "bind $cams_bindn cams_go $cams_bindn"
31 cams_bindnext
32
33 set cams_bindmode 0
34
35 alias +cams_save_mode "set cams_bindmode 1"
36 alias -cams_save_mode "set cams_bindmode 0"
37 alias +cams_move_mode "set cams_bindmode 2"
38 alias -cams_move_mode "set cams_bindmode 0"
39
40 alias cams_go "if $cams_bindmode == 0 cams_load %1 else if $cams_bindmode == 1 cams_save %1 else cams_move %1"
41 alias cams_load "cam_angles $cam_angles_saved%1; cam_pos $cam_pos_saved%1"
42 alias cams_save "set cam_angles_saved%1 $cam_angles; set cam_pos_saved%1 $cam_pos; cams_save_detailed %1"
43
44 // this saves each value to separated variable. it's being used in the move
45 alias cams_save_detailed "cams_save_detang %1; cams_save_detpos %1"
46 alias cams_save_detang "set cams_angles_saved_pitch%1 $cam_angles_pitch; set cams_angles_saved_yaw%1 $cam_angles_yaw; set cams_angles_saved_roll%1 $cam_angles_roll"
47 alias cams_save_detpos "set cams_pos_saved_x%1 $cam_pos_x; set cams_pos_saved_y%1 $cam_pos_y; set cams_pos_saved_z%1 $cam_pos_z"
48
49 // here we do the calculations for the smooth camera movement
50 // note: I really should have written this in TCL :)
51
52 alias cams_move "set cams_part_moves %1; set cams_part_curm 1; if $cams_part_moves >= 1 cams_move_partial $cams_part_curm"
53 alias cams_move_partial "cams_calc_steps %1; cams_store_alias; cams_replace_alias; set cams_cappedframes 0"
54 alias cams_store_alias "set_alias_str cams_stored_alias f_captureframe"
55 // alias cams_restore_alias "alias f_captureframe $cams_stored_alias"
56 alias cams_finish_move "inc cams_part_curm; if $cams_part_curm <= $cams_part_moves cams_move_partial $cams_part_curm else cams_restore_alias"
57 alias cams_restore_alias "alias f_captureframe" // yes, this will clear f_captureframe alias, not "clean" but better behavior than something else
58 alias cams_replace_alias "alias f_captureframe cams_moveframe"
59 alias cams_calc_steps "cams_calc_diffs %1; cams_calc_divs"
60 alias cams_calc_diffs "set_calc cams_step_x $cams_pos_saved_x%1 - $cam_pos_x; set_calc cams_step_y $cams_pos_saved_y%1 - $cam_pos_y; set_calc cams_step_z $cams_pos_saved_z%1 - $cam_pos_z; cams_calc_yaw_diff %1; set_calc cams_step_pitch $cams_angles_saved_pitch%1 - $cam_angles_pitch"
61
62 // will calculate the horizontal turn and check if it's bigger than 180 degrees
63 alias cams_calc_yaw_diff "set_calc cams_step_yaw $cams_angles_saved_yaw%1 - $cam_angles_yaw; if $cams_step_yaw > 180 cams_calc_yaw_complement; if $cams_step_yaw < -180 cams_calc_yaw_comp_neg" // get the shortest of the two possible ways: CW/CCW
64 // if the turn was bigger than 180 degrees, it will use 360 degrees complement
65 alias cams_calc_yaw_complement "set_calc cams_step_yaw $cams_step_yaw - 360"
66 alias cams_calc_yaw_comp_neg "set_calc cams_step_yaw $cams_step_yaw + 360"
67 alias cams_calc_divs "set_calc cams_step_x $cams_step_x / $cams_moveframes; set_calc cams_step_y $cams_step_y / $cams_moveframes; set_calc cams_step_z $cams_step_z / $cams_moveframes; set_calc cams_step_yaw $cams_step_yaw / $cams_moveframes; set_calc cams_step_pitch $cams_step_pitch / $cams_moveframes"
68 alias cams_moveframe "cams_move_pos; cams_move_ang; inc cams_cappedframes; if $cams_cappedframes >= $cams_moveframes cams_finish_move"
69 alias cams_move_pos "set_calc cams_tx $cam_pos_x + $cams_step_x; set_calc cams_ty $cam_pos_y + $cams_step_y; set_calc cams_tz $cam_pos_z + $cams_step_z; cam_pos $cams_tx $cams_ty $cams_tz"
70 alias cams_move_ang "set_calc cams_tw $cam_angles_yaw + $cams_step_yaw; set_calc cams_tp $cam_angles_pitch + $cams_step_pitch; cam_angles $cams_tp $cams_tw 0"
71
72
73 // 1) calculate 6 steps
74 // 2) save current f_captureframe alias
75 // 3) set new f_captureframe alias
76
77 alias cams_clear "unset_re cam_angles."