./cinema_clip_editor.lua

  1. -- IMPORTANT: Button and dialog data defined at end of Lua file (CCE_buttons) 
  2.  
  3. -- Corner_positions 
  4. local BTN_POS_TOP = 110			-- Top row of buttons 
  5. local BTN_POS_LEFT = 80 		-- Left edge 
  6. local BTN_POS_RIGHT = (1280 - 80) -- Right edge 
  7. if vint_is_std_res() then 
  8. 	BTN_POS_RIGHT = (960 - 80) 
  9. end 
  10. local BTN_POS_BOTTOM = 720 - 40 	-- Bottom row of buttons 
  11.  
  12. -- Global variables 
  13. Cinema_clip_editor_doc_handle = -1 
  14.  
  15. -- Mouse input 
  16. Mouse_input_tracker = -1 
  17. -- Get the Back/Esc button when moving the camera or selecting a target 
  18. Input_tracker = -1 
  19.  
  20. CCE_option_beginner_mode = false 
  21.  
  22. -- Button variables 
  23. local Num_buttons = 0 
  24.  
  25. -- Completely transparent backdrop for capturing mouse_move events 
  26. local Button_bg 
  27.  
  28. -- Colors for some of the elements 
  29. local COLOR_DIALOG_HEADING = {R=80/255, G=75/255, B=78/255} 
  30. local COLOR_KEYS_KEY = {R=180/255, G=50/255, B=230/255} 
  31. local COLOR_KEYS_ACTION = {R=180/255, G=180/255, B=180/255} 
  32. local COLOR_EXPORT_TITLE = {R=160/255, G=160/255, B=160/255} 
  33. local COLOR_EXPORT_LOCKED = {R=80/255, G=75/255, B=78/255} 
  34. local COLOR_EXPORT_UNLOCKED = {R=160/255, G=0/255, B=0/255} 
  35. local COLOR_TOOLTIP_TEXT = {R=160/255, G=160/255, B=160/255} 
  36.  
  37. -- Sizing constants 
  38. local ICON_BUTTON_WIDTH = 35 
  39. local DIALOG_TOP = 128 
  40. local DIALOG_TITLE_OFFSET = 5 
  41. local DIALOG_SPACING = 28 
  42. local DIALOG_HEADER = 35 
  43. local DIALOG_BUTTON_OFFSET = 17 
  44. local DIALOG_X_MIN = 125 
  45. local DIALOG_X_MAX = 1280 - DIALOG_X_MIN 
  46. local DIALOG_SIDE_BUFFER = 6 
  47.  
  48. local KEYS_BOTTOM = 680 
  49. local KEYS_CENTER = 640 
  50. local KEYS_BUFFER = 10 
  51. local KEYS_SPACING = 20 
  52.  
  53. -- Defines for zone property option lists 
  54. local PROP_TYPE_CUT = 0 
  55. local PROP_TYPE_BLEND = 1 
  56. local PROP_MODE_DEFAULT = 0 
  57. local PROP_MODE_STATIC = 1 
  58. local PROP_MODE_FOLLOW = 2 
  59. local PROP_MODE_FOLLOW_LOOK = 3 
  60. local PROP_MODE_FOLLOW_WATCH = 4 
  61. local PROP_MODE_TRACKING = 5 
  62. local PROP_DOF_OFF = 0 
  63. local PROP_DOF_ZOOM = 1 
  64. local PROP_DOF_CLOSEUP = 2 
  65. local PROP_DOF_NORMAL = 3 
  66. local PROP_SLOMO_OFF = 0 
  67. local PROP_SLOMO_HALF = 1 
  68. local PROP_SLOMO_QUARTER = 2 
  69. local PROP_EASE_LINEAR = 0 
  70. local PROP_EASE_IN = 1 
  71. local PROP_EASE_OUT = 2 
  72. local PROP_EASE_BOTH = 3 
  73.  
  74. -- Popup to show the shortcut and control keys 
  75. local Keys_popup = { 
  76. 	x = 0, y = 0, w = 0, h = 0, -- Position and size 
  77. 	visible = true, 
  78. 	bg = nil,	-- Backdrop 
  79. 	split = 14, 
  80. 	num_keys = 0, 
  81. 	text_key = {}, -- Text for keys (change to have key bitmap as well?) 
  82. 	text_action = {}, -- Text for key controls 
  83. } 
  84.  
  85. -- Simple popup to show when video is exporting and if the camera is locked or not 
  86. local Export_popup = { 
  87. 	export_text = nil, 
  88. 	camera_text = nil, 
  89. 	x = 640, y = 110, 
  90. } 
  91.  
  92. local Tooltip = { 
  93. 	tooltip_text = nil, 
  94. 	x = 640, y = 680, 
  95. } 
  96.  
  97. -- Default data for what the keys popup will show 
  98. -- Eventually get this data from the game instead of hardcoding it 
  99. local Keys_data = { 
  100. 	[1] = { key = "MOVE*", action = "MOVE CAMERA" }, 
  101. 	[2] = { key = "AIM*", action = "ROTATE CAMERA" }, 
  102. 	[3] = { key = "E*", action = "MOVE CAMERA UP" }, 
  103. 	[4] = { key = "C*", action = "MOVE CAMERA DOWN" }, 
  104. 	[5] = { key = "1*", action = "TILT CAMERA LEFT" }, 
  105. 	[6] = { key = "2*", action = "TILT CAMERA RIGHT" }, 
  106. 	[7] = { key = "4*", action = "DECREASE FOV" }, 
  107. 	[8] = { key = "5*", action = "INCREASE FOV" }, 
  108. 	[9] = { key = "7*", action = "DECREASE HANDYCAM" }, 
  109. 	[10] = { key = "8*", action = "INCREASE HANDYCAM" }, 
  110. 	[11] = { key = "9*", action = "DECREASE DOF DISTANCE" }, 
  111. 	[12] = { key = "0*", action = "INCREASE DOF DISTANCE" }, 
  112. 	[13] = { key = "O*", action = "DECREASE DOF FOCAL RANGE" }, 
  113. 	[14] = { key = "P*", action = "INCREASE DOF FOCAL RANGE" }, 
  114. 	[15] = { key = "*+SHFT", action = "- FASTER" }, 
  115. 	[16] = { key = "*+CTRL", action = "- SLOWER" }, 
  116. 	[17] = { key = "HOLD Z", action = "HEADING-ONLY ROTATION" }, 
  117. 	[18] = { key = "HOLD X", action = "PITCH-ONLY ROTATION" }, 
  118. 	[19] = { key = "", action = "" }, 
  119. 	[20] = { key = "SPC", action = "PLAY/PAUSE" }, 
  120. 	[21] = { key = "SHFT+SPC", action = "PLAY TO NEXT ZONE" }, 
  121. 	[22] = { key = "ENTER", action = "SHOW/HIDE ZONE PROPERTIES" }, 
  122. 	[23] = { key = "L", action = "TOGGLE ZONE LOCK" }, 
  123. 	[24] = { key = "N", action = "CYCLE FOLLOW MODE" }, 
  124. 	[25] = { key = "T", action = "TOGGLE TARGET ICONS" }, 
  125. 	[26] = { key = "SHFT+T", action = "TARGET SELECT MODE" }, 
  126. 	[27] = { key = "SHFT+M", action = "EDIT CAMERA POSITION" }, 
  127. 	[28] = { key = "G", action = "CYCLE SLOW-MO TYPE" }, 
  128. 	[29] = { key = "I", action = "CYCLE DEPTH OF FIELD TYPE" }, 
  129. } 
  130.  
  131. -- These objects are located in the VINT doc, but are only for cloning usage, not actual UI 
  132. local Base_button 
  133. local Base_dialog_bg 
  134. local Base_dialog_text 
  135. local Base_keys_bg 
  136. local Base_keys_text 
  137.  
  138. -- These objects are located in the VINT doc, and are only used once 
  139. local Export_progress_meter	-- Used to show the state of exporting 
  140. local Hint_bar						-- Used to show which button to push in certain modes (cannot be clicked on) 
  141.  
  142. -- Confirmation popup data/constants (used for export/exit/rewind) 
  143. local Confirm_popup 
  144. local CONFIRM_LIST_SIZE = 427 
  145. local CONFIRM_CHOICES_EXIT = {  
  146. 	[1] = { type = TYPE_BUTTON, label = "EXIT", id = 1, }, 
  147. 	[2] = { type = TYPE_BUTTON, label = "CANCEL", id = 2, }, 
  148. } 
  149. local CONFIRM_CHOICES_EXPORT = {  
  150. 	[1] = { type = TYPE_BUTTON, label = "EXPORT", id = 1, }, 
  151. 	[2] = { type = TYPE_BUTTON, label = "CANCEL", id = 2, }, 
  152. } 
  153. local CONFIRM_CHOICES_REWIND = {  
  154. 	[1] = { type = TYPE_BUTTON, label = "REWIND", id = 1, }, 
  155. 	[2] = { type = TYPE_BUTTON, label = "CANCEL", id = 2, }, 
  156. } 
  157. local CONFIRM_CHOICES_CAMERA = {  
  158. 	[1] = { type = TYPE_BUTTON, label = "EDIT", id = 1, }, 
  159. 	[2] = { type = TYPE_BUTTON, label = "CANCEL", id = 2, }, 
  160. } 
  161.  
  162. function cinema_clip_editor_init() 
  163. 	-- Handle all the standard res coordinates 
  164. 	if vint_is_std_res() then 
  165. 		Export_popup.x = 480 
  166. 		Tooltip.x = 480 
  167. 		KEYS_CENTER = 480 
  168. 	end 
  169. 	Cinema_clip_editor_doc_handle = vint_document_find("cinema_clip_editor") 
  170. 	 
  171. 	-- This backdrop is here to catch mouse_move events when not over a button 
  172. 	--  (It's a hack, but one which may ship because this might be the only screen/interface that's mouse-only) 
  173. 	Button_bg = Vdo_base_object:new("button_bg", 0, Cinema_clip_editor_doc_handle) 
  174. 	Button_bg:set_visible(false) 
  175. 	 
  176. 	-- Init the base objects 
  177. 	Base_button = Vdo_button_pc:new("button_base") 
  178. 	Base_dialog_bg = Vdo_base_object:new("dialog_bg", 0, Cinema_clip_editor_doc_handle) 
  179. 	Base_dialog_text = Vdo_base_object:new("dialog_text", 0, Cinema_clip_editor_doc_handle) 
  180. 	Base_keys_bg = Vdo_base_object:new("keys_bg", 0, Cinema_clip_editor_doc_handle) 
  181. 	Base_keys_text = Vdo_base_object:new("keys_text", 0, Cinema_clip_editor_doc_handle) 
  182. 	 
  183. 	-- Init the special objects 
  184. 	Export_progress_meter = Vdo_export_progress_meter:new("progress_meter") 
  185. 	Hint_bar = Vdo_hint_bar:new("hint_bar") 
  186. 	 
  187. 	-- Setup confirmation popup 
  188. 	Confirm_popup = Vdo_store_popup:new("confirm_popup", 0, Cinema_clip_editor_doc_handle) 
  189. 	Confirm_popup:set_visible(false) 
  190. 	Confirm_popup:set_size(CONFIRM_LIST_SIZE, (LIST_BUTTON_HEIGHT * 5) + (LIST_BUTTON_SPACE * 5)) 
  191. 	Confirm_popup:set_color(COLOR_SAINTS_PURPLE, COLOR_STORE_REWARDS_SECONDARY, COLOR_STORE_REWARDS_TERTIARY) 
  192.  
  193. 	-- Create all the buttons (and dialogs) 
  194. 	-- Reminder: Data for buttons and dialogs is at the END of this file 
  195. 	 
  196. 	-- Start with the buttons not associated with a dialog 
  197. 	-- Rewind/Play/Pause/Options/AV buttons 
  198. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_REWIND], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 0.5, BTN_POS_TOP) 
  199. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_PLAY_SLOW], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 2.0, BTN_POS_TOP) 
  200. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_PLAY], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 3.0 + 4, BTN_POS_TOP) 
  201. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_PLAY_FAST], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 4.0 + 8, BTN_POS_TOP) 
  202. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_PAUSE], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 5.0 + 12, BTN_POS_TOP) 
  203. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_OPTIONS], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 6.5 + 12, BTN_POS_TOP) 
  204. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_AV], BTN_POS_LEFT + ICON_BUTTON_WIDTH * 8.0 + 12, BTN_POS_TOP) 
  205. 	 
  206. 	-- Save/Export/Exit buttons 
  207. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_SAVE], BTN_POS_RIGHT - ICON_BUTTON_WIDTH * 3.5, BTN_POS_TOP) 
  208. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_EXPORT], BTN_POS_RIGHT - ICON_BUTTON_WIDTH * 2.0, BTN_POS_TOP) 
  209. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_EXIT], BTN_POS_RIGHT - ICON_BUTTON_WIDTH * 0.5, BTN_POS_TOP) 
  210. 	-- Also move the Export_progress_meter below the export button 
  211. 	Export_progress_meter:set_anchor(BTN_POS_RIGHT - ICON_BUTTON_WIDTH * 2.0, BTN_POS_TOP + 30) 
  212. 	Export_progress_meter:update(true, "EXPORT_READY", 0.0, false) 
  213. 	 
  214. 	-- Show Keys button (aligned left) 
  215. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_SHOW_KEYS], BTN_POS_LEFT, BTN_POS_BOTTOM) 
  216. 	cinema_clip_editor_button_align_left(CCE_free_buttons[BTN_FREE_SHOW_KEYS], 150) 
  217. 	-- Hide the SHOW KEYS BUTTON (might not be used) 
  218. 	CCE_free_buttons[BTN_FREE_SHOW_KEYS].button:set_visible(false) 
  219. 	 
  220. 	-- Hide HUD button (aligned right) 
  221. 	cinema_clip_editor_button_create(CCE_free_buttons[BTN_FREE_HIDE_HUD], BTN_POS_RIGHT, BTN_POS_BOTTOM) 
  222. 	cinema_clip_editor_button_align_right(CCE_free_buttons[BTN_FREE_HIDE_HUD], 150) 
  223. 	 
  224. 	-- Hidden Show HUD button (aligned to same location as Hide HUD button, but not in a group) 
  225. 	CCE_free_buttons[BTN_FREE_SHOW_HUD].button = Vdo_button_pc:new("button_show_hud") 
  226. 	CCE_free_buttons[BTN_FREE_SHOW_HUD].button:create(CCE_free_buttons[BTN_FREE_SHOW_HUD].data) 
  227. 	CCE_free_buttons[BTN_FREE_SHOW_HUD].button:set_anchor(BTN_POS_RIGHT, BTN_POS_BOTTOM + 720) -- Offscreen so it doesn't mess up the Hide HUD button 
  228. 	if vint_is_std_res() then 
  229. 		CCE_free_buttons[BTN_FREE_SHOW_HUD].button:set_scale(0.66667, 0.66667) 
  230. 	end 
  231. 	cinema_clip_editor_button_align_right(CCE_free_buttons[BTN_FREE_SHOW_HUD], 150) 
  232. 	 
  233. 	-- Camera zone dialog (buttons are initialized inside dialog_init) 
  234. 	local dialog = CCE_dialogs[DLG_CAMERA_ZONE] 
  235. 	cinema_clip_editor_dialog_add_heading(dialog, 4, "PC_NEW_ZONE") 
  236. 	cinema_clip_editor_dialog_init(dialog) 
  237.  
  238. 	-- Options dialog 
  239. 	dialog = CCE_dialogs[DLG_OPTIONS] 
  240. 	--cinema_clip_editor_dialog_add_heading(dialog, 4, "PC_EXPORT_SETTINGS") 
  241. 	--cinema_clip_editor_dialog_add_heading(dialog, 6, "PC_CHARACTER_MODEL") 
  242. 	cinema_clip_editor_dialog_init(dialog) 
  243. 	cinema_clip_editor_dialog_slide(dialog, dialog.x_pos) -- Make sure it's aligned correctly 
  244. 	 
  245. 	-- AV dialog 
  246. 	dialog = CCE_dialogs[DLG_AV] 
  247. 	cinema_clip_editor_dialog_add_heading(dialog, 3, "PC_GREEN_SCREEN") 
  248. 	cinema_clip_editor_dialog_add_heading(dialog, 7, "PC_AUDIO_TOGGLES") 
  249. 	cinema_clip_editor_dialog_init(dialog) 
  250. 	cinema_clip_editor_dialog_slide(dialog, dialog.x_pos) -- Make sure it's aligned correctly 
  251.  
  252. 	-- Properties dialog 
  253. 	dialog = CCE_dialogs[DLG_PROP] 
  254. 	cinema_clip_editor_dialog_add_heading(dialog, 6, "PC_ADDITIONAL_PROPS") 
  255. 	cinema_clip_editor_dialog_init(dialog) 
  256. 		 
  257. 	-- Cancel dialog (used for submodes: selecting target and positioning camera) 
  258. 	-- Note that this dialog is hacked up a bit because it uses a hint_bar 
  259. 	dialog = CCE_dialogs[DLG_CANCEL] 
  260. 	cinema_clip_editor_dialog_init(dialog) 
  261. 	 
  262. 	-- Set CCE_buttons to be the button master list (for easier mouse processing) 
  263. 	cinema_clip_editor_set_button_ref() 
  264. 	Num_buttons = #CCE_buttons 
  265. 	 
  266. 	-- Init the timeline 
  267. 	cinema_clip_editor_timeline_init() 
  268. 	 
  269. 	-- Init mouse controls (not using "if PC" because this screen will only be used on PC) 
  270. 	Mouse_input_tracker = Vdo_input_tracker:new() 
  271. 	for i = 1, Num_buttons do 
  272. 		if CCE_buttons[i].data.type == PC_TYPE_SLIDER then 
  273. 			-- Arrow and slider controls for sliders 
  274. 			CCE_buttons[i].button:add_mouse_inputs("cinema_clip_editor", Mouse_input_tracker, false) 
  275. 			cinema_clip_editor_slider_add_extra_inputs(CCE_buttons[i].button, Mouse_input_tracker) 
  276. 		elseif CCE_buttons[i].data.type == PC_TYPE_TOGGLE then 
  277. 			-- Toggles also get input tracking for their left arrow 
  278. 			CCE_buttons[i].button:add_mouse_inputs("cinema_clip_editor", Mouse_input_tracker, true) 
  279. 			cinema_clip_editor_toggle_add_arrow_inputs(CCE_buttons[i].button, Mouse_input_tracker) 
  280. 		else 
  281. 			-- Other buttons are straightforward 
  282. 			CCE_buttons[i].button:add_mouse_inputs("cinema_clip_editor", Mouse_input_tracker, true) 
  283. 		end 
  284. 	end 
  285. 	-- Show HUD button 
  286. 	Mouse_input_tracker:add_mouse_input("mouse_move", "cinema_clip_editor_mouse_move", 0, Button_bg.handle) 
  287.  
  288. 	-- Add inputs for the timeline 
  289. 	cinema_clip_editor_timeline_add_mouse_inputs(Mouse_input_tracker) 
  290. 	 
  291. 	-- Done adding mouse inputs, subscribe to them 
  292. 	Mouse_input_tracker:subscribe(true) 
  293. 	 
  294. 	-- Button input tracker 
  295. 	Input_tracker = Vdo_input_tracker:new() 
  296. 	Input_tracker:add_input("back", "cinema_clip_editor_button_back", 50)	 
  297. 	Input_tracker:subscribe(true) 
  298. 	 
  299. 	-- Hide the dialogs by default 
  300. 	for i = 1, #CCE_dialogs do 
  301. 		cinema_clip_editor_dialog_hide(CCE_dialogs[i]) 
  302. 	end 
  303. 	 
  304. 	-- Create the keys popup (and hide it) 
  305. 	cinema_clip_editor_keys_init(Keys_popup, Keys_data) 
  306. 	cinema_clip_editor_keys_toggle_visibility(Keys_popup) 
  307. 	 
  308. 	-- Create the export popup (and hide it) 
  309. 	cinema_clip_editor_exporting_init(Export_popup) 
  310. 	cinema_clip_editor_exporting_set_locked(Export_popup, true) 
  311. 	cinema_clip_editor_exporting_set_visibility(Export_popup, false) 
  312. 	 
  313. 	-- Create the tooltip text 
  314. 	cinema_clip_editor_tooltip_init(Tooltip) 
  315. 	 
  316. 	-- Hide the base objects 
  317. 	Base_button:set_visible(false) 
  318. 	Base_dialog_bg:set_visible(false) 
  319. 	Base_dialog_text:set_visible(false) 
  320. 	Base_keys_text:set_visible(false) 
  321. 	Base_keys_bg:set_visible(false) 
  322. 	 
  323. 	Hint_bar:set_visible(false) 
  324. 	 
  325. 	-- Reset the play/pause buttons 
  326. 	cinema_clip_editor_cb_pause(CCE_free_buttons[BTN_FREE_PAUSE].button) 
  327. 	 
  328. 	-- Export/encoder status update (disabled for now) 
  329. 	Export_progress_meter:set_visible(false) 
  330. 	--vint_dataitem_add_subscription("encoder_info_di", "update", "cinema_clip_editor_encoder_info_di") 
  331. end 
  332.  
  333. -- Update the export progress meter 
  334. function cinema_clip_editor_encoder_info_di(di_h) 
  335. 	local progress, state = vint_dataitem_get(di_h) 
  336. 	local status_text = "" 
  337. 	 
  338. 	if state ~= 1 then 
  339. 		if state == 3 then 
  340. 			progress = 1 
  341. 			status_text = "EXPORT_DONE" 
  342. 		else 
  343. 			progress = 0 
  344. 			if state == 2 then 
  345. 				status_text = "EXPORT_ERROR" 
  346. 			else 
  347. 				status_text = "EXPORT_READY" 
  348. 			end 
  349. 		end 
  350. 	else 
  351. 		status_text = "EXPORT_IN_PROGRESS" 
  352. 	end 
  353. 	 
  354. 	Export_progress_meter:update(true, status_text, progress, false) 
  355. end 
  356.  
  357. -- Get references to all the buttons, save them in one table (for easier mouse input processing) 
  358. function cinema_clip_editor_set_button_ref() 
  359. 	-- First get all the non-dialog buttons 
  360. 	for i = 1, #CCE_free_buttons do 
  361. 		CCE_buttons[i] = CCE_free_buttons[i] 
  362. 	end 
  363. 	 
  364. 	-- Then add all the dialogs' buttons 
  365. 	local cce_counter = #CCE_buttons 
  366. 	for i = 1, #CCE_dialogs do 
  367. 		for j = 1, #CCE_dialogs[i].buttons do 
  368. 			cce_counter = cce_counter + 1 
  369. 			CCE_buttons[cce_counter] = CCE_dialogs[i].buttons[j] 
  370. 		end 
  371. 		if CCE_dialogs[i].ease_buttons ~= nil then 
  372. 			for j = 1, #CCE_dialogs[i].ease_buttons do 
  373. 				cce_counter = cce_counter + 1 
  374. 				CCE_buttons[cce_counter] = CCE_dialogs[i].ease_buttons[j] 
  375. 			end 
  376. 		end 
  377. 	end 
  378. 	 
  379. end 
  380.  
  381. function cinema_clip_editor_cleanup() 
  382. 	if Mouse_input_tracker ~= nil then 
  383. 		Mouse_input_tracker:subscribe(false) 
  384. 	end 
  385. 	Input_tracker:subscribe(false) 
  386. end 
  387.  
  388.  
  389. -------------------------------------------------------------------------- 
  390. -- Special case (keys and exporting) popup functions 
  391. -------------------------------------------------------------------------- 
  392.  
  393. function cinema_clip_editor_tooltip_init(popup) 
  394. 	popup.tooltip_text = Vdo_base_object:clone(Base_keys_text.handle) 
  395. 	 
  396. 	-- Set alignment, color, default text, and position 
  397. 	popup.tooltip_text:set_property("auto_offset", "n") 
  398. 	popup.tooltip_text:set_color(COLOR_TOOLTIP_TEXT) 
  399. 	popup.tooltip_text:set_anchor(popup.x, popup.y) 
  400. 	popup.tooltip_text:set_scale(0.8, 0.8) 
  401. 	vint_set_property(popup.tooltip_text.handle, "shadow_enabled", true) 
  402. 	vint_set_property(popup.tooltip_text.handle, "shadow_offset", 2, 2) 
  403. 	 
  404. 	cinema_clip_editor_tooltip_set_text(" ") 
  405. end 
  406.  
  407. function cinema_clip_editor_tooltip_set_text(text) 
  408. 	Tooltip.tooltip_text:set_text(text) 
  409. end 
  410.  
  411. -- Create the exporting popup 
  412. function cinema_clip_editor_exporting_init(popup) 
  413. 	popup.export_text = Vdo_base_object:clone(Base_keys_text.handle) 
  414. 	popup.camera_text = Vdo_base_object:clone(Base_dialog_text.handle) 
  415. 	 
  416. 	-- Set alignment, color, text, and move them where they should be 
  417. 	popup.export_text:set_property("auto_offset", "s") 
  418. 	popup.export_text:set_color(COLOR_EXPORT_TITLE) 
  419. 	popup.export_text:set_text("PC_EXPORTING_VIDEO") 
  420. 	popup.export_text:set_anchor(popup.x, popup.y) 
  421. 	popup.export_text:set_scale(0.8, 0.8) 
  422. 	 
  423. 	popup.camera_text:set_property("auto_offset", "n") 
  424. 	popup.camera_text:set_anchor(popup.x, popup.y) 
  425. 	popup.camera_text:set_scale(0.5, 0.5) 
  426. 	-- Text and color set in exporting_set_locked 
  427. end 
  428.  
  429. -- Set the export popup text to locked or unlocked (and change text color) 
  430. function cinema_clip_editor_exporting_set_locked(popup, locked) 
  431. 	if locked then 
  432. 		popup.camera_text:set_color(COLOR_EXPORT_LOCKED) 
  433. 		popup.camera_text:set_text("PC_CAMERA_LOCKED") 
  434. 	else 
  435. 		popup.camera_text:set_color(COLOR_EXPORT_UNLOCKED) 
  436. 		popup.camera_text:set_text("PC_CAMERA_UNLOCKED") 
  437. 	end 
  438. end 
  439.  
  440. -- Show/hide the export popup 
  441. function cinema_clip_editor_exporting_set_visibility(popup, visible) 
  442. 	popup.export_text:set_visible(visible) 
  443. 	popup.camera_text:set_visible(visible) 
  444. end 
  445.  
  446.  
  447. -- Creates the keys popup 
  448. function cinema_clip_editor_keys_init(popup, data) 
  449. 	popup.bg = Vdo_base_object:clone(Base_keys_bg.handle) 
  450. 	popup.num_keys = #data 
  451. 	for i = 1, popup.num_keys do 
  452. 		-- Create the key and action text 
  453. 		popup.text_key[i] = Vdo_base_object:clone(Base_keys_text.handle) 
  454. 		popup.text_action[i] = Vdo_base_object:clone(Base_keys_text.handle) 
  455. 		popup.text_key[i]:set_color(COLOR_KEYS_KEY) 
  456. 		popup.text_action[i]:set_color(COLOR_KEYS_ACTION) 
  457. 	end 
  458. 	 
  459. 	cinema_clip_editor_keys_reset_and_resize(popup, data) 
  460. end 
  461.  
  462. -- Reloads the text from data and resizes the popup appropriately 
  463. function cinema_clip_editor_keys_reset_and_resize(popup, data) 
  464. 	local w1 = 0 
  465. 	local w2 = 0 
  466. 	 
  467. 	-- Set text (using data) and measure the widths 
  468. 	for i = 1, popup.num_keys do	 
  469. 		popup.text_key[i]:set_text(data[i].key) 
  470. 		popup.text_action[i]:set_text(data[i].action) 
  471. 		 
  472. 		local w = popup.text_key[i]:get_actual_size() + 2 -- A little padding 
  473. 		if (w > w1) then 
  474. 			w1 = w 
  475. 		end 
  476. 		w = popup.text_action[i]:get_actual_size() + 2 -- A little padding 
  477. 		if (w > w2) then 
  478. 			w2 = w 
  479. 		end 
  480. 	end 
  481. 		 
  482. 	-- Calculate the width and how far to offset column 2 
  483. 	local column_2_offset = (w1 + w2) + KEYS_BUFFER 
  484. 	popup.w = (w1 + w2) * 2 + KEYS_BUFFER * 2 
  485. 	 
  486. 	-- Figure out how many rows of keys will show, apply this info to the popup's height 
  487. 	local max_rows = popup.split 
  488. 	if (popup.num_keys - popup.split > max_rows) then 
  489. 		max_rows = popup.num_keys - popup.split 
  490. 	end 
  491. 	popup.h = max_rows * KEYS_SPACING + KEYS_BUFFER 
  492. 	 
  493. 	-- Set the popup's upper left corner 
  494. 	popup.x = KEYS_CENTER - popup.w * 0.5 
  495. 	popup.y = KEYS_BOTTOM - popup.h 
  496. 	 
  497. 	-- Position and resize the backdrop 
  498. 	popup.bg:set_anchor(popup.x, popup.y) 
  499. 	popup.bg:set_actual_size(popup.w, popup.h) 
  500. 	 
  501. 	-- Space the keys out (1st column) 
  502. 	for i = 1, popup.split do 
  503. 		popup.text_key[i]:set_anchor(popup.x + KEYS_BUFFER * 0.5, popup.y + KEYS_BUFFER * 0.5 + (i - 1) * KEYS_SPACING) 
  504. 		popup.text_action[i]:set_anchor(popup.x + KEYS_BUFFER * 0.5 + (w1 + 2), popup.y + KEYS_BUFFER * 0.5 + (i - 1) * KEYS_SPACING) 
  505. 	end 
  506. 	-- 2nd column 
  507. 	for i = popup.split + 1, popup.num_keys do 
  508. 		popup.text_key[i]:set_anchor(popup.x + KEYS_BUFFER * 0.5 + column_2_offset, popup.y + KEYS_BUFFER * 0.5 + (i - popup.split - 1) * KEYS_SPACING) 
  509. 		popup.text_action[i]:set_anchor(popup.x + KEYS_BUFFER * 0.5 + (w1 + 2) + column_2_offset, popup.y + KEYS_BUFFER * 0.5 + (i - popup.split - 1) * KEYS_SPACING) 
  510. 	end 
  511. end 
  512.  
  513. -- Toggles the visibility of the keys popup 
  514. function cinema_clip_editor_keys_toggle_visibility(popup) 
  515. 	if (popup.visible) then 
  516. 		popup.visible = false 
  517. 	else 
  518. 		popup.visible = true  
  519. 	end 
  520. 	cinema_clip_editor_keys_apply_visibility(popup) 
  521. end 
  522.  
  523. -- Applies visible state of the keys popup 
  524. function cinema_clip_editor_keys_apply_visibility(popup) 
  525. 	popup.bg:set_visible(popup.visible) 
  526. 	for i = 1, popup.num_keys do 
  527. 		popup.text_key[i]:set_visible(popup.visible) 
  528. 		popup.text_action[i]:set_visible(popup.visible) 
  529. 	end 
  530. end 
  531.  
  532. --- 
  533. -- Confirmation popup functions 
  534. --- 
  535.  
  536. -- Select between the different confirmation options 
  537. function cinema_clip_editor_confirm_nav(event, value) 
  538. 	--if event == "nav_up" then	 
  539. 	--	Store_popup.list:move_cursor(-1)	 
  540. 	--elseif event == "nav_down" then 
  541. 	--	Store_popup.list:move_cursor(1) 
  542. 	if event == "mouse_move" then 
  543. 		-- value contains the target_handle in this case 
  544. 		local new_index = Confirm_popup.list:get_button_index(value) 
  545. 		if new_index ~= 0 then 
  546. 			Confirm_popup.list:set_selection(new_index) 
  547. 			Confirm_popup.list:move_cursor(0, true) 
  548. 		end 
  549. 	else 
  550. 		--do nothing 
  551. 	end 
  552. end	 
  553.  
  554. local Acquire_something = false 
  555. local Acquire_target = false 
  556.  
  557. function cinema_clip_editor_button_back(event) 
  558. 	if Acquire_something then 
  559. 		cinema_clip_editor_cb_cancel() 
  560. 		Acquire_something = false 
  561. 	end 
  562. end 
  563.  
  564. -------------------------------------------------------------------------- 
  565. -- Button helper functions 
  566. -------------------------------------------------------------------------- 
  567.  
  568. -- Create a button at the position given 
  569. -- See the buttons definition for the format of data 
  570. function cinema_clip_editor_button_create(data, x, y) 
  571. 	-- Create a new vdo_button_pc based off the base 
  572. 	data.button = Vdo_button_pc:clone(Base_button.handle) 
  573.  
  574. 	data.button:create(data.data) 
  575. 	data.button:set_anchor(x, y) 
  576. 	 
  577. 	if (data.data.type == PC_TYPE_ICON) then 
  578. 		data.button:set_width(ICON_BUTTON_WIDTH, 0) 
  579. 	else 
  580. 		-- These widths are usually overridden, but there's no reason not to set them 
  581. 		if (data.data.type == PC_TYPE_NORMAL) then 
  582. 			data.button:set_width(150, 0) 
  583. 		else 
  584. 			data.button:set_width(200, 100) 
  585. 		end 
  586. 	end 
  587. end 
  588.  
  589. -- Aligns a label-only button with the following rules: 
  590. -- The button's width is the greater of min_width and the button's label's actual width 
  591. -- The button's left side is aligned with its current anchor 
  592. function cinema_clip_editor_button_align_left(data, min_width) 
  593. 	local width = cinema_clip_editor_button_label_get_width(data.button, min_width) 
  594. 	data.button:set_width(width, 0) 
  595. 	data.button:move(width * 0.5, 0) 
  596. end 
  597.  
  598. -- Aligns a label-only button with the following rules: 
  599. -- The buttons width is the greater of min_width and the button's label's actual width 
  600. -- The button's right side is aligned with its current anchor 
  601. function cinema_clip_editor_button_align_right(data, min_width) 
  602. 	local width = cinema_clip_editor_button_label_get_width(data.button, min_width) 
  603. 	data.button:set_width(width, 0) 
  604. 	data.button:move(-width * 0.5, 0) 
  605. end 
  606.  
  607. -- Find the width of the button's label 
  608. function cinema_clip_editor_button_label_get_width(button, min_width) 
  609. 	local width = button:get_label_width() 
  610. 	if (min_width > width) then 
  611. 		width = min_width 
  612. 	end 
  613. 	return width 
  614. end 
  615.  
  616. -------------------------------------------------------------------------- 
  617. -- Mouse input functions 
  618. -------------------------------------------------------------------------- 
  619. -- NOTE: Mouse input functions operate using CCE_buttons, and so use button_ids to pass info instead of direct references 
  620.  
  621. -- Primary mouse move function (sets highlighting on/off) 
  622. function cinema_clip_editor_mouse_move(event, target_handle) 
  623. 	for i = 1, Num_buttons do 
  624. 		-- Highlight the button if I'm over it, otherwise unhighlight it 
  625. 		if CCE_buttons[i].button.handle == target_handle then 
  626. 			if CCE_buttons[i].button:is_active() and CCE_buttons[i].button:get_visible() then 
  627. 				CCE_buttons[i].button:mouse_move() 
  628. 				cinema_clip_editor_tooltip_set_text(CCE_buttons[i].button:get_tooltip()) 
  629. 			end 
  630. 		else  
  631. 			CCE_buttons[i].button:mouse_off() 
  632. 		end 
  633. 	end 
  634. 	 
  635. 	if target_handle == Button_bg.handle then 
  636. 		cinema_clip_editor_tooltip_set_text("") 
  637. 	end 
  638. 	 
  639. 	cinema_clip_editor_timeline_mouse_off() 
  640. end 
  641.  
  642. -- Primary mouse click function (sets highlighting and calls the button's callback function) 
  643. function cinema_clip_editor_mouse_click(event, target_handle) 
  644. 	for i = 1, Num_buttons do 
  645. 		-- Activate the button 
  646. 		if CCE_buttons[i].button.handle == target_handle then 
  647. 			if CCE_buttons[i].button:is_active()  and CCE_buttons[i].button:get_visible() then 
  648. 				-- Pass the actual button along instead of the button_id (many callback functions do something to the button and don't care about the id) 
  649. 				CCE_buttons[i].callback(CCE_buttons[i].button) 
  650. 				CCE_buttons[i].button:mouse_click() 
  651. 			end 
  652. 		end 
  653. 	end 
  654. 	 
  655. end 
  656.  
  657. -- Add mouse inputs for sliders (slider box and two arrows) 
  658. function cinema_clip_editor_slider_add_extra_inputs(button, input_tracker) 
  659. 	-- Slider 
  660. 	input_tracker:add_mouse_input("mouse_click", "cinema_clip_editor_slider_mouse_click", 0, button.bar_outline.handle) 
  661. 	input_tracker:add_mouse_input("mouse_drag", "cinema_clip_editor_slider_mouse_drag", 0, button.bar_outline.handle) 
  662. 	input_tracker:add_mouse_input("mouse_drag_release", "cinema_clip_editor_slider_mouse_drag_release", 0, button.bar_outline.handle) 
  663. 	-- Arrows 
  664. 	input_tracker:add_mouse_input("mouse_click", "cinema_clip_editor_slider_left_arrow_click", 0, button.img_left.handle) 
  665. 	input_tracker:add_mouse_input("mouse_move", "cinema_clip_editor_slider_left_arrow_move", 0, button.img_left.handle) 
  666. 	input_tracker:add_mouse_input("mouse_click", "cinema_clip_editor_slider_right_arrow_click", 0, button.img_right.handle) 
  667. 	input_tracker:add_mouse_input("mouse_move", "cinema_clip_editor_slider_right_arrow_move", 0, button.img_right.handle) 
  668. end 
  669.  
  670. -- Add mouse inputs for toggle left arrows (right arrow does the same as clicking anywhere else) 
  671. function cinema_clip_editor_toggle_add_arrow_inputs(button, input_tracker) 
  672. 	input_tracker:add_mouse_input("mouse_click", "cinema_clip_editor_toggle_left_arrow_click", 0, button.img_left.handle) 
  673. 	input_tracker:add_mouse_input("mouse_move", "cinema_clip_editor_toggle_left_arrow_move", 0, button.img_left.handle) 
  674. end 
  675.  
  676. -- The following group of functions: Respond to the toggle mouse events 
  677. function cinema_clip_editor_toggle_left_arrow_click(event, target_handle) 
  678. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  679. 	 
  680. 	-- Perform the callback function (with a negative direction) 
  681. 	if button_id > 0 then  
  682. 		CCE_buttons[button_id].callback(CCE_buttons[button_id].button, 1) 
  683. 		CCE_buttons[button_id].button:mouse_click() 
  684. 	end 
  685. end 
  686.  
  687. function cinema_clip_editor_toggle_left_arrow_move(event, target_handle) 
  688. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  689. 	if button_id > 0 then  
  690. 		CCE_buttons[button_id].button:mouse_move() 
  691. 	end 
  692. end 
  693.  
  694. -- The following group of functions: Respond to slider arrow mouse events 
  695. function cinema_clip_editor_slider_left_arrow_click(event, target_handle) 
  696. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  697. 	if button_id > 0 then 
  698. 		CCE_buttons[button_id].button:slider_arrow_click(true) 
  699. 		CCE_buttons[button_id].callback(CCE_buttons[button_id].button) 
  700. 	end 
  701. end 
  702.  
  703. function cinema_clip_editor_slider_left_arrow_move(event, target_handle) 
  704. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  705. 	if button_id > 0 then 
  706. 		CCE_buttons[button_id].button:slider_arrow_move(true) 
  707. 	end 
  708. end 
  709.  
  710. function cinema_clip_editor_slider_right_arrow_click(event, target_handle) 
  711. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  712. 	if button_id > 0 then 
  713. 		CCE_buttons[button_id].button:slider_arrow_click(false) 
  714. 		CCE_buttons[button_id].callback(CCE_buttons[button_id].button) 
  715. 	end 
  716. end 
  717.  
  718. function cinema_clip_editor_slider_right_arrow_move(event, target_handle) 
  719. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  720. 	if button_id > 0 then 
  721. 		CCE_buttons[button_id].button:slider_arrow_move(false) 
  722. 	end 
  723. end 
  724.  
  725. -- Respond to the slider drag event 
  726. function cinema_clip_editor_slider_mouse_drag(event, target_handle, mouse_x, mouse_y) 
  727. 	local button_id = cinema_clip_editor_get_button_index(target_handle) 
  728. 	if button_id > 0 then 
  729. 		CCE_buttons[button_id].button:mouse_set_slider(mouse_x) 
  730. 		CCE_buttons[button_id].callback(CCE_buttons[button_id].button) 
  731. 	end 
  732. end 
  733.  
  734. -- Dummy function to make the slider respond to drag events 
  735. function cinema_clip_editor_slider_mouse_click(event, target_handle) 
  736. end 
  737.  
  738. -- Dummy function to make the slider respond to drag events 
  739. function cinema_clip_editor_slider_mouse_drag_release(event, target_handle, mouse_x, mouse_y) 
  740. end 
  741.  
  742. -- Returns the index of the button if its arrow/slider was clicked/moved over 
  743. function cinema_clip_editor_get_button_index(target_handle) 
  744. 	for i = 1, Num_buttons do 
  745. 		if CCE_buttons[i].button.img_left.handle == target_handle or CCE_buttons[i].button.img_right.handle == target_handle or CCE_buttons[i].button.bar_outline.handle == target_handle then 
  746. 			-- Check if the button is active and visible 
  747. 			if CCE_buttons[i].button:is_active() and CCE_buttons[i].button:get_visible() then 
  748. 				cinema_clip_editor_all_buttons_mouse_off() 
  749. 				return i 
  750. 			end 
  751. 		end 
  752. 	end 
  753.  
  754. 	-- If no matching target handle was found, return an invalid index 
  755. 	return 0 
  756. end 
  757.  
  758. -- Unhighlights all buttons 
  759. function cinema_clip_editor_all_buttons_mouse_off() 
  760. 	for i = 1, Num_buttons do 
  761. 		CCE_buttons[i].button:mouse_off() 
  762. 	end 
  763. 	 
  764. 	-- Hide the timeline marker 
  765. 	cinema_clip_editor_timeline_mouse_off() 
  766. end 
  767.  
  768. -------------------------------------------------------------------------- 
  769. -- Dialog management functions 
  770. -------------------------------------------------------------------------- 
  771.  
  772. -- Init a dialog 
  773. function cinema_clip_editor_dialog_init(dialog) 
  774. 	-- Background and text header 
  775. 	dialog.bg = Vdo_base_object:clone(Base_dialog_bg.handle) 
  776. 	dialog.text = Vdo_base_object:clone(Base_dialog_text.handle) 
  777. 	 
  778. 	-- Create the buttons 
  779. 	for i = 1, dialog.num_buttons do 
  780. 		cinema_clip_editor_button_create(dialog.buttons[i]) 
  781. 	end 
  782. 	 
  783. 	-- The hide dialog button (clone, set the hide reference, then custom create it) 
  784. 	dialog.buttons[dialog.num_buttons + 1].button = Vdo_button_pc:clone(Base_button.handle) 
  785. 	dialog.hide = dialog.buttons[dialog.num_buttons + 1].button 
  786. 	dialog.hide:create(dialog.buttons[dialog.num_buttons + 1].data) 
  787. 	dialog.hide:set_icon_scale(0.5) 
  788. 	dialog.hide:set_width(16, 0) 
  789. 	 
  790. 	-- Set the title text 
  791. 	dialog.text:set_text(dialog.title) 
  792. 	dialog.text:set_color(COLOR_DIALOG_HEADING) 
  793. 	 
  794. 	if dialog.ease_buttons ~= nil then 
  795. 		-- This only applies to the Properties dialog 
  796. 		cinema_clip_editor_dialog_add_ease_buttons(dialog) 
  797. 	end 
  798. 	 
  799. 	cinema_clip_editor_dialog_resize_and_move(dialog) 
  800. end 
  801.  
  802. -- Move and resize the dialog (using its internal data) 
  803. function cinema_clip_editor_dialog_resize_and_move(dialog) 
  804. 	cinema_clip_editor_dialog_set_min_width(dialog, dialog.width, dialog.value_width) 
  805. 	dialog.bg:set_actual_size(dialog.width, dialog.num_buttons * DIALOG_SPACING + dialog.num_headings * DIALOG_HEADER + 32) 
  806. 	cinema_clip_editor_dialog_move(dialog, false) 
  807. end 
  808.  
  809. -- Quickly set the title and hint button text, then resize the dialog 
  810. -- Used only for special dialogs (aka DLG_CANCEL) 
  811. function cinema_clip_editor_dialog_quick_set_and_resize(dialog, text_title, text_button, width) 
  812. 	dialog.width = width 
  813. 	dialog.text:set_text(text_title) 
  814. 	-- This will make sure the dialog bg is wide enough (though probably unnecessary) 
  815. 	dialog.buttons[1].button:set_label("ESC_"..text_button) 
  816. 	dialog.text:set_scale(0.35, 0.35) 
  817. 	 
  818. 	cinema_clip_editor_dialog_resize_and_move(dialog) 
  819. 	 
  820. 	-- Now make the first adjustments to force this to show the hint_bar instead 
  821. 	local hint_data = { {CTRL_MENU_BUTTON_B, text_button},} 
  822. 	Hint_bar:set_hints(hint_data)  
  823. 	 
  824. 	local w, h = Hint_bar:get_size() 
  825. 	local x = dialog.x_pos - w * 0.5 
  826. 	Hint_bar:set_anchor(x, DIALOG_TOP + DIALOG_BUTTON_OFFSET + 26) 
  827. 	Hint_bar:set_visible(true) 
  828. end 
  829.  
  830. -- Add a heading to a dialog 
  831. -- space = which button # to appear above 
  832. function cinema_clip_editor_dialog_add_heading(dialog, space, txt) 
  833. 	dialog.num_headings = dialog.num_headings + 1 
  834. 	dialog.spacers[dialog.num_headings] = space 
  835. 	dialog.headings[dialog.num_headings] = Vdo_base_object:clone(Base_dialog_text.handle) 
  836. 	dialog.headings[dialog.num_headings]:set_text(txt) 
  837. 	dialog.headings[dialog.num_headings]:set_color(COLOR_DIALOG_HEADING) 
  838. end 
  839.  
  840. -- Move the dialog to the position stored in dialog.x_pos (and sets button sizes) 
  841. -- Does NOT constrain the x_pos 
  842. function cinema_clip_editor_dialog_move(dialog, offscreen) 
  843. 	local dialog_top = DIALOG_TOP 
  844. 	 
  845. 	-- Maybe move the dialog offscreen (so it doesn't interfere with the mouse) 
  846. 	if offscreen == true then 
  847. 		dialog_top = 720 
  848. 	end 
  849. 	 
  850. 	-- If the dialog has ease_buttons and they are set, then move those 
  851. 	if dialog.ease_buttons ~= nil then 
  852. 		cinema_clip_editor_dialog_move_ease_buttons(dialog, dialog_top) 
  853. 	end 
  854. 	 
  855. 	-- Move the basic dialog elements 
  856. 	dialog.text:set_anchor(dialog.x_pos, dialog_top + DIALOG_TITLE_OFFSET) 
  857. 	dialog.bg:set_anchor(dialog.x_pos, dialog_top) 
  858. 	dialog.hide:set_anchor(dialog.x_pos + (dialog.width * 0.5) - 13, dialog_top + 13) 
  859. 	 
  860. 	-- Move the headings and buttons 
  861. 	local heading_count = 0 
  862. 	for i = 1, dialog.num_buttons do 
  863. 		-- If there's a next heading, see if it should be inserted here 
  864. 		if (dialog.num_headings > heading_count) then 
  865. 			if (i == dialog.spacers[heading_count + 1]) then 
  866. 				-- Set the anchor for this heading 
  867. 				dialog.headings[heading_count + 1]:set_anchor(dialog.x_pos, dialog_top + i * DIALOG_SPACING + heading_count * DIALOG_HEADER + 13) 
  868. 				-- Increment the count, so that all future headings/buttons are offset 
  869. 				heading_count = heading_count + 1 
  870. 			end 
  871. 		end 
  872. 		 
  873. 		-- Now set the next button 
  874. 		-- Determine the value width 
  875. 		local w = dialog.value_width 
  876. 		if (dialog.buttons[i].data.type == PC_TYPE_NORMAL) then 
  877. 			w = 0 
  878. 		end 
  879. 		-- Set the button width 
  880. 		dialog.buttons[i].button:set_width(dialog.width - DIALOG_SIDE_BUFFER, w) 
  881. 		 
  882. 		-- Set the button position 
  883. 		dialog.buttons[i].button:set_anchor(dialog.x_pos, dialog_top + i * DIALOG_SPACING + heading_count * DIALOG_HEADER + DIALOG_BUTTON_OFFSET) 
  884. 	end -- for 
  885. end 
  886.  
  887. -- Sets the widths (total and value) of the dialog 
  888. function cinema_clip_editor_dialog_set_min_width(dialog, total_min_width, value_min_width) 
  889. 	-- First find the minimums for the button label and value text fields 
  890. 	local min_label = 0 
  891. 	local min_value = 0 
  892. 	local has_arrows = false -- Set to true if any buttons have L/R arrows, so width will be padded later 
  893. 	 
  894. 	-- Find button minimum widths 
  895. 	for i = 1, dialog.num_buttons do 
  896. 		-- Save a reference to this button so the following code is more readable 
  897. 		local btn = dialog.buttons[i] 
  898. 		 
  899. 		local w = btn.button:get_label_width() 
  900. 		if (w > min_label) then 
  901. 			min_label = w 
  902. 		end 
  903. 		 
  904. 		-- For toggle buttons: 
  905. 		--  Set each value and measure the results 
  906. 		if btn.data.type == PC_TYPE_TOGGLE then 
  907. 			has_arrows = true 
  908. 			for j = 1, #btn.data.options do 
  909. 				btn.button:set_value(btn.data.options[j]) 
  910. 				w = btn.button:get_value_width() 
  911. 				if (w > min_value) then 
  912. 					min_value = w 
  913. 				end 
  914. 			end 
  915. 			 
  916. 			-- Set the label back to default value 
  917. 			btn.button:set_value(btn.data.options[btn.data.o_index]) 
  918. 		else 
  919. 			-- Otherwise just ask for a width 
  920. 			w = btn.button:get_value_width() 
  921. 			if (w > min_value) then 
  922. 				min_value = w 
  923. 			end 
  924. 			 
  925. 			if btn.data.type == PC_TYPE_SLIDER then 
  926. 				has_arrows = true 
  927. 			end 
  928. 		end 
  929. 		 
  930. 	end 
  931. 	 
  932. 	-- Set the value width 
  933. 	if (value_min_width > min_value) then 
  934. 		min_value = value_min_width 
  935. 	end 
  936. 	 
  937. 	dialog.value_width = min_value 
  938. 	 
  939. 	-- Total width based on buttons 
  940. 	local total = min_value + min_label + DIALOG_SIDE_BUFFER 
  941. 	if has_arrows == true then 
  942. 		local arrow_width = Base_button:get_arrow_double_width() 
  943. 		total = total + arrow_width 
  944. 	end 
  945. 	 
  946. 	-- Now measure the headings (title and other) 
  947. 	local min_heading = dialog.text:get_actual_size() + 3 + 50 -- Add a little padding + extra for the close button 
  948. 	for i = 1, dialog.num_headings do 
  949. 		local w = dialog.headings[i]:get_actual_size() + 3 
  950. 		if (w > min_heading) then 
  951. 			min_heading = w 
  952. 		end 
  953. 	end 
  954. 	 
  955. 	-- Enlarge for title/headings in dialog if necessary 
  956. 	if (min_heading > total) then 
  957. 		total = min_heading 
  958. 	end 
  959. 	 
  960. 	-- Set the total width 
  961. 	if (total_min_width > total) then 
  962. 		total = total_min_width 
  963. 	end 
  964. 	 
  965. 	dialog.width = total 
  966. end 
  967.  
  968. -- Hides all elements of the dialog 
  969. function cinema_clip_editor_dialog_hide(dialog) 
  970. 	cinema_clip_editor_dialog_move(dialog, true) 
  971. 	dialog.bg:set_visible(false) 
  972. 	dialog.text:set_visible(false) 
  973. 	dialog.hide:set_visible(false) 
  974. 	for i = 1, dialog.num_headings do 
  975. 		dialog.headings[i]:set_visible(false) 
  976. 	end 
  977. 	for i = 1, dialog.num_buttons do 
  978. 		dialog.buttons[i].button:set_visible(false) 
  979. 	end 
  980. 	dialog.visible = false 
  981. end 
  982.  
  983. -- Shows all elements of the dialog 
  984. function cinema_clip_editor_dialog_show(dialog) 
  985. 	-- Hide all other dialogs 
  986. 	for i = 1, #CCE_dialogs do 
  987. 		if dialog ~= CCE_dialogs[i] then 
  988. 			cinema_clip_editor_dialog_hide(CCE_dialogs[i]) 
  989. 		end 
  990. 	end 
  991. 	 
  992. 	cinema_clip_editor_dialog_move(dialog, false) 
  993. 	dialog.bg:set_visible(true) 
  994. 	dialog.text:set_visible(true) 
  995. 	dialog.hide:set_visible(true) 
  996. 	for i = 1, dialog.num_headings do 
  997. 		dialog.headings[i]:set_visible(true) 
  998. 	end 
  999. 	for i = 1, dialog.num_buttons do 
  1000. 		dialog.buttons[i].button:set_visible(true) 
  1001. 	end 
  1002. 	dialog.visible = true 
  1003. end 
  1004.  
  1005. function cinema_clip_editor_dialog_hide_all() 
  1006. 	for i = 1, #CCE_dialogs do 
  1007. 		cinema_clip_editor_dialog_hide(CCE_dialogs[i]) 
  1008. 	end 
  1009. end 
  1010.  
  1011. -- Add ease buttons to the dialog 
  1012. function cinema_clip_editor_dialog_add_ease_buttons(dialog, button_offset) 
  1013. 	-- Create the buttons 
  1014. 	for i = 1, #dialog.ease_lines do 
  1015. 		cinema_clip_editor_button_create(dialog.ease_buttons[i], 0, 0)	 
  1016. 		 
  1017. 		-- Set special icon parameters 
  1018. 		dialog.ease_buttons[i].button:set_icon_mid() 
  1019. 		dialog.ease_buttons[i].button:set_width(24, 0) 
  1020. 		 
  1021. 		-- Hide the button by default 
  1022. 		dialog.ease_buttons[i].button:set_visible(false) 
  1023. 	end 
  1024. 	 
  1025. 	cinema_clip_editor_dialog_move_ease_buttons(dialog, DIALOG_TOP) 
  1026. end 
  1027.  
  1028. -- Move/resize the ease buttons 
  1029. function cinema_clip_editor_dialog_move_ease_buttons(dialog, dialog_top) 
  1030. 	for i = 1, #dialog.ease_lines do		 
  1031. 		-- Get the info about how to align the buttons 
  1032. 		local line = dialog.ease_lines[i] 
  1033. 		local heading_count = dialog.ease_headers[i] 
  1034. 		 
  1035. 		-- Set the button position 
  1036. 		dialog.ease_buttons[i].button:set_anchor(dialog.x_pos + dialog.width * 0.5 + 14, dialog_top + line * DIALOG_SPACING + heading_count * DIALOG_HEADER + DIALOG_BUTTON_OFFSET) 
  1037. 	end 
  1038. end 
  1039.  
  1040. function cinema_clip_editor_dialog_camera_zone_slide(x) 
  1041. 	cinema_clip_editor_dialog_slide(CCE_dialogs[DLG_CAMERA_ZONE], x) 
  1042. 	cinema_clip_editor_dialog_slide(CCE_dialogs[DLG_PROP], x) 
  1043. 	 
  1044. 	if CCE_dialogs[DLG_CAMERA_ZONE].visible == false and CCE_dialogs[DLG_PROP].visible == false then 
  1045. 		cinema_clip_editor_dialog_show(CCE_dialogs[DLG_CAMERA_ZONE]) 
  1046. 	end 
  1047. 	if CCE_option_beginner_mode == true then 
  1048. 		if cinema_clip_editor_zone_active() ~= cinema_clip_editor_zone_highlight() then 
  1049. 			cinema_clip_editor_dialog_show(CCE_dialogs[DLG_CAMERA_ZONE]) 
  1050. 		end 
  1051. 	end 
  1052. 	 
  1053. 	cinema_clip_editor_dialog_move(CCE_dialogs[DLG_CAMERA_ZONE], not CCE_dialogs[DLG_CAMERA_ZONE].visible) 
  1054. 	cinema_clip_editor_dialog_move(CCE_dialogs[DLG_PROP], not CCE_dialogs[DLG_PROP].visible) 
  1055. 	cinema_clip_editor_prop_update_dialog_general() 
  1056. end 
  1057.  
  1058. function cinema_clip_editor_dialog_slide(dialog, x) 
  1059. 	local new_x = x 
  1060. 	new_x = max(new_x, dialog.width * 0.5 + DIALOG_SIDE_BUFFER * 4) 
  1061. 	new_x = min(new_x, 1280 - dialog.width * 0.5 - DIALOG_SIDE_BUFFER * 4) 
  1062. 	 
  1063. 	dialog.x_pos = new_x 
  1064. end 
  1065.  
  1066. -------------------------------------------------------------------------- 
  1067. -- Button actions (callback functions) 
  1068. -------------------------------------------------------------------------- 
  1069.  
  1070. -- Callback functions for buttons (top and bottom row) 
  1071. function cinema_clip_editor_cb_rewind(click_button) 
  1072. 	-- Actually rewind, since we didn't go back	 
  1073. 	vint_dataresponder_post("cinema_editor_dr", "Rewind") 
  1074. 	 
  1075. 	-- Reset the play/pause buttons 
  1076. 	vint_dataresponder_post("cinema_editor_dr", "Pause") 
  1077. 	cinema_clip_editor_cb_pause(CCE_free_buttons[BTN_FREE_PAUSE].button) 
  1078. 	 
  1079. 	Rewinding = true 
  1080. 	Playback_disabled = false 
  1081. 	 
  1082. 	--[[Confirm_popup:populate_list(CONFIRM_CHOICES_REWIND, 1, CONFIRM_LIST_SIZE, 2)	 
  1083. 	Confirm_popup:set_title("REWIND WARNING") 
  1084. 	Confirm_popup:set_text("A LOADING SCREEN WILL APPEAR WHILE REWINDING") 
  1085. 	Confirm_popup:nav_enable(true, "cinema_clip_editor_rewind_final", "cinema_clip_editor_confirm_nav") 
  1086. 	 
  1087. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1088. 	everything:set_alpha(.5) 
  1089. 	 
  1090. 	Mouse_input_tracker:subscribe(false)]]-- 
  1091. end 
  1092.  
  1093. --[[function cinema_clip_editor_rewind_final(event) 
  1094. 	if event == "back" then 
  1095. 		return 
  1096. 	end 
  1097. 	 
  1098. 	Confirm_popup:nav_enable(false, nil, nil) 
  1099. 	 
  1100. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1101. 	everything:set_alpha(1.0) 
  1102. 	Mouse_input_tracker:subscribe(true) 
  1103. 		 
  1104. 	-- Did we select NO?  This assumes YES is the first item, NO the second 
  1105. 	if Confirm_popup:get_selected_data() ~= 1 then 
  1106. 		return 
  1107. 	end 
  1108. 	 
  1109. 	Rewinding = true 
  1110. 	Playback_disabled = false 
  1111. 	 
  1112. 	-- Actually rewind, since we didn't go back	 
  1113. 	vint_dataresponder_post("cinema_editor_dr", "Rewind") 
  1114. 	 
  1115. 	-- Reset the play/pause buttons 
  1116. 	cinema_clip_editor_cb_pause(CCE_free_buttons[BTN_FREE_PAUSE].button) 
  1117. end]]-- 
  1118.  
  1119. function cinema_clip_editor_cb_play_slow(click_button) 
  1120. 	vint_dataresponder_post("cinema_editor_dr", "Play", 0.25) 
  1121. 	cinema_clip_editor_playback_buttons(true) 
  1122. 	CCE_free_buttons[BTN_FREE_PLAY_SLOW].button:set_inactive() 
  1123. 	CCE_free_buttons[BTN_FREE_PAUSE].button:set_active() 
  1124. 	Rewinding = false 
  1125. end 
  1126.  
  1127. function cinema_clip_editor_cb_play(click_button) 
  1128. 	vint_dataresponder_post("cinema_editor_dr", "Play", 1.0) 
  1129. 	cinema_clip_editor_playback_buttons(true) 
  1130. 	CCE_free_buttons[BTN_FREE_PLAY].button:set_inactive() 
  1131. 	CCE_free_buttons[BTN_FREE_PAUSE].button:set_active() 
  1132. 	Rewinding = false 
  1133. end 
  1134.  
  1135. function cinema_clip_editor_cb_play_fast(click_button) 
  1136. 	vint_dataresponder_post("cinema_editor_dr", "Play", 4.0) 
  1137. 	cinema_clip_editor_playback_buttons(true) 
  1138. 	CCE_free_buttons[BTN_FREE_PLAY_FAST].button:set_inactive() 
  1139. 	CCE_free_buttons[BTN_FREE_PAUSE].button:set_active() 
  1140. 	Rewinding = false 
  1141. end 
  1142.  
  1143. function cinema_clip_editor_cb_pause(click_button) 
  1144. 	vint_dataresponder_post("cinema_editor_dr", "Pause") 
  1145. 	click_button:set_inactive() 
  1146. 	cinema_clip_editor_playback_buttons(true) 
  1147. end 
  1148.  
  1149. -- Set the state of the playback buttons 
  1150. function cinema_clip_editor_playback_buttons(active) 
  1151. 	if active then 
  1152. 		CCE_free_buttons[BTN_FREE_PLAY_SLOW].button:set_active() 
  1153. 		CCE_free_buttons[BTN_FREE_PLAY].button:set_active() 
  1154. 		CCE_free_buttons[BTN_FREE_PLAY_FAST].button:set_active() 
  1155. 	else 
  1156. 		CCE_free_buttons[BTN_FREE_PLAY_SLOW].button:set_inactive() 
  1157. 		CCE_free_buttons[BTN_FREE_PLAY].button:set_inactive() 
  1158. 		CCE_free_buttons[BTN_FREE_PLAY_FAST].button:set_inactive() 
  1159. 	end 
  1160. end 
  1161.  
  1162. function cinema_clip_editor_cb_options(click_button) 
  1163. 	cinema_clip_editor_options_dialog_fill_data() 
  1164. 	cinema_clip_editor_dialog_show(CCE_dialogs[DLG_OPTIONS]) 
  1165. end 
  1166.  
  1167. function cinema_clip_editor_cb_av(click_button) 
  1168. 	cinema_clip_editor_av_dialog_fill_data() 
  1169. 	cinema_clip_editor_dialog_show(CCE_dialogs[DLG_AV]) 
  1170. end 
  1171.  
  1172. function cinema_clip_editor_cb_save(click_button) 
  1173. 	game_vkeyboard_input("SAVE_CLIP", "SAVE_CLIP_NAME", 64, "SAVE_CLIP", "cce_cb_save_confirm", true) 
  1174. 	vint_dataresponder_post("cinema_editor_dr", "Save") 
  1175. end 
  1176.  
  1177. function cce_cb_save_confirm(success) 
  1178. 	if success == true then 
  1179. 		cinema_editor_save_clip("VKEYBOARD_RESULTS") 
  1180. 	end 
  1181. end 
  1182.  
  1183. -- TODO: Move this elsewhere and make it show via code (data item?) 
  1184. --Export_lock = not Export_lock 
  1185. --cinema_clip_editor_exporting_set_locked(Export_popup, Export_lock) 
  1186. --Export_visible = not Export_visible 
  1187. --cinema_clip_editor_exporting_set_visibility(Export_popup, Export_visible) 
  1188.  
  1189. function cinema_clip_editor_cb_export(click_button) 
  1190. 	Confirm_popup:populate_list(CONFIRM_CHOICES_EXPORT, 1, CONFIRM_LIST_SIZE, 2)	 
  1191. 	Confirm_popup:set_title("PC_CONFIRM_EXPORT") 
  1192. 	Confirm_popup:set_text("PC_EXPORT_EXPLANATION") 
  1193. 	Confirm_popup:nav_enable(true, "cinema_clip_editor_export_final", "cinema_clip_editor_confirm_nav") 
  1194. 	 
  1195. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1196. 	everything:set_alpha(.5) 
  1197. 	 
  1198. 	Mouse_input_tracker:subscribe(false) 
  1199. end 
  1200.  
  1201. -- Confirm or back out of exiting 
  1202. function cinema_clip_editor_export_final(event) 
  1203. 	-- No keyboard/gamepad processing, so ignore BACK 
  1204. 	if event == "back" then 
  1205. 		return 
  1206. 	end 
  1207. 	 
  1208. 	Confirm_popup:nav_enable(false, nil, nil) 
  1209. 	 
  1210. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1211. 	everything:set_alpha(1.0) 
  1212. 	Mouse_input_tracker:subscribe(true) 
  1213. 		 
  1214. 	-- Did we select NO?  This assumes YES is the first item, NO the second 
  1215. 	if Confirm_popup:get_selected_data() ~= 1 then 
  1216. 		return 
  1217. 	end 
  1218. 	 
  1219. 	-- Actually exit, since we didn't go back 
  1220. 	vint_dataresponder_post("cinema_editor_dr", "Export") 
  1221. end 
  1222.  
  1223.  
  1224. function cinema_clip_editor_cb_exit(click_button) 
  1225. 	Confirm_popup:populate_list(CONFIRM_CHOICES_EXIT, 1, CONFIRM_LIST_SIZE, 2)	 
  1226. 	Confirm_popup:set_title("PC_CONFIRM_EXIT") 
  1227. 	Confirm_popup:set_text("PC_EXIT_EXPLANATION") 
  1228. 	Confirm_popup:nav_enable(true, "cinema_clip_editor_exit_final", "cinema_clip_editor_confirm_nav") 
  1229. 	 
  1230. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1231. 	everything:set_alpha(.5) 
  1232. 	 
  1233. 	--cinema_clip_editor_dialog_hide_all() 
  1234. 	Mouse_input_tracker:subscribe(false) 
  1235. end 
  1236.  
  1237. -- Confirm or back out of exiting 
  1238. function cinema_clip_editor_exit_final(event) 
  1239. 	-- No keyboard/gamepad processing, so ignore BACK 
  1240. 	if event == "back" then 
  1241. 		return 
  1242. 	end 
  1243. 	 
  1244. 	Confirm_popup:nav_enable(false, nil, nil) 
  1245. 	 
  1246. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1247. 	everything:set_alpha(1.0) 
  1248. 	Mouse_input_tracker:subscribe(true) 
  1249. 		 
  1250. 	-- Did we select NO?  This assumes YES is the first item, NO the second 
  1251. 	if Confirm_popup:get_selected_data() ~= 1 then 
  1252. 		return 
  1253. 	end 
  1254. 	 
  1255. 	-- Actually exit, since we didn't go back 
  1256. 	vint_dataresponder_post("cinema_editor_dr", "Quit") 
  1257. end 
  1258.  
  1259. function cinema_clip_editor_cb_show_keys(click_button) 
  1260. 	cinema_clip_editor_keys_toggle_visibility(Keys_popup) 
  1261. 	if (Keys_popup.visible) then 
  1262. 		click_button:set_label("PC_HIDE_KEYS") 
  1263. 	else  
  1264. 		click_button:set_label("PC_SHOW_KEYS") 
  1265. 	end 
  1266. end 
  1267.  
  1268. function cinema_clip_editor_cb_toggle_hud(visible) 
  1269. 	-- Hide everything 
  1270. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1271. 	everything:set_visible(visible) 
  1272. end 
  1273.  
  1274. function cinema_clip_editor_cb_hide_hud(click_button) 
  1275. 	-- Hide everything 
  1276. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1277. 	--everything:set_visible(false) 
  1278. 	everything:set_alpha(0.4) 
  1279. 	 
  1280. 	-- Show the show hud button (and highlight it) 
  1281. 	CCE_buttons[BTN_FREE_SHOW_HUD].button:set_visible(true) 
  1282. 	if vint_is_std_res() then 
  1283. 		CCE_buttons[BTN_FREE_SHOW_HUD].button:set_anchor((BTN_POS_RIGHT - 75) * 0.66667, BTN_POS_BOTTOM * 0.66667) 
  1284. 	else 
  1285. 		CCE_buttons[BTN_FREE_SHOW_HUD].button:set_anchor(BTN_POS_RIGHT - 75, BTN_POS_BOTTOM) 
  1286. 	end 
  1287. 	CCE_buttons[BTN_FREE_SHOW_HUD].button:mouse_move() 
  1288. end 
  1289.  
  1290. function cinema_clip_editor_cb_show_hud(click_button) 
  1291. 	-- Show everything 
  1292. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1293. 	--everything:set_visible(true) 
  1294. 	everything:set_alpha(1.0) 
  1295. 	 
  1296. 	-- Hide the show hud button 
  1297. 	CCE_buttons[BTN_FREE_SHOW_HUD].button:set_visible(false) 
  1298. 	CCE_buttons[BTN_FREE_SHOW_HUD].button:set_anchor(BTN_POS_RIGHT, BTN_POS_BOTTOM + 720) 
  1299. 	 
  1300. 	-- Highlight the Hide HUD button 
  1301. 	CCE_buttons[BTN_FREE_HIDE_HUD].button:mouse_move() 
  1302. end 
  1303.  
  1304. -- Callback functions for buttons (camera zone dialog) 
  1305. function cinema_clip_editor_cb_cz_edit_properties(click_button) 
  1306. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_CAMERA_ZONE]) 
  1307. 		 
  1308. 	local current_zone = cinema_clip_editor_zone_get_current() 
  1309. 	cinema_clip_editor_prop_dialog_fill_data(current_zone) 
  1310. 	cinema_clip_editor_dialog_show(CCE_dialogs[DLG_PROP]) 
  1311. end 
  1312.  
  1313. function cinema_clip_editor_cb_cz_copy_current(click_button) 
  1314. 	cinema_clip_editor_zone_insert(Marker_time_timeline, true) 
  1315. end 
  1316.  
  1317. function cinema_clip_editor_cb_cz_copy_next(click_button) 
  1318. 	cinema_clip_editor_zone_insert(Marker_time_timeline, false) 
  1319. end 
  1320.  
  1321. function cinema_clip_editor_cb_cz_delete(click_button) 
  1322. 	cinema_clip_editor_zone_delete_current() 
  1323. end 
  1324.  
  1325. function cinema_clip_editor_cb_cz_hide(click_button) 
  1326. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_CAMERA_ZONE]) 
  1327. 	CCE_free_buttons[BTN_FREE_REWIND].button:set_active() 
  1328. end 
  1329.  
  1330. -- Callback functions for buttons (options dialog) 
  1331. function cinema_clip_editor_cb_opt_advanced(click_button, dir) 
  1332. 	local direction = dir or 0 
  1333. 	click_button:toggle_dir(direction) 
  1334. 	 
  1335. 	if click_button:get_option_index() == 1 then 
  1336. 		CCE_option_beginner_mode = true 
  1337. 	else 
  1338. 		CCE_option_beginner_mode = false 
  1339. 	end 
  1340. end 
  1341.  
  1342. function cinema_clip_editor_cb_opt_rotation_sens(click_button) 
  1343. 	local sens_move = CCE_dialogs[DLG_OPTIONS].buttons[BTN_OPT_MOVEMENT].button.s_value 
  1344. 	local sens_rot = CCE_dialogs[DLG_OPTIONS].buttons[BTN_OPT_ROTATION].button.s_value 
  1345. 	vint_dataresponder_post("cinema_editor_dr", "set_sensitivity", sens_move / 100, sens_rot / 100) 
  1346. end 
  1347.  
  1348. function cinema_clip_editor_cb_opt_movement_sens(click_button) 
  1349. 	local sens_move = CCE_dialogs[DLG_OPTIONS].buttons[BTN_OPT_MOVEMENT].button.s_value 
  1350. 	local sens_rot = CCE_dialogs[DLG_OPTIONS].buttons[BTN_OPT_ROTATION].button.s_value 
  1351. 	vint_dataresponder_post("cinema_editor_dr", "set_sensitivity", sens_move / 100, sens_rot / 100) 
  1352. end 
  1353.  
  1354. -- These options don't work currently 
  1355. --[[function cinema_clip_editor_cb_opt_show_output(click_button, dir) 
  1356. 	local direction = dir or 0 
  1357. 	click_button:toggle_dir(direction) 
  1358. 	 
  1359. 	local output_only = CCE_dialogs[DLG_OPTIONS].buttons[BTN_OPT_OUTPUT].button:get_option_index() - 1 
  1360. 	vint_dataresponder_post("cinema_editor_dr", "Show_output_only", output_only) 
  1361. end 
  1362.  
  1363. function cinema_clip_editor_cb_opt_watermark(click_button, dir) 
  1364. 	local direction = dir or 0 
  1365. 	click_button:toggle_dir(direction) 
  1366. 	 
  1367. 	local watermark = CCE_dialogs[DLG_OPTIONS].buttons[BTN_OPT_WATERMARK].button:get_option_index() - 1 
  1368. 	vint_dataresponder_post("cinema_editor_dr", "Watermark", watermark) 
  1369. end 
  1370.  
  1371. function cinema_clip_editor_cb_opt_create_import(click_button) 
  1372. 	-- TODO: Hook this up to code (or remove it) 
  1373. end 
  1374. function cinema_clip_editor_cb_opt_load_default(click_button) 
  1375. 	-- TODO: Hook this up to code (or remove it) 
  1376. end]] 
  1377.  
  1378. function cinema_clip_editor_cb_opt_hide(click_button) 
  1379. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_OPTIONS]) 
  1380. 	CCE_free_buttons[BTN_FREE_OPTIONS].button:set_active() 
  1381. end 
  1382.  
  1383. -- Callback functions for buttons (AV dialog) 
  1384. function cinema_clip_editor_cb_av_time_of_day(click_button, dir) 
  1385. 	local direction = dir or 0 
  1386. 	click_button:toggle_dir(direction) 
  1387. 	 
  1388. 	local tod_preset = CCE_dialogs[DLG_AV].buttons[BTN_AV_TIME_OF_DAY].button:get_option_index() - 1 
  1389. 	vint_dataresponder_post("cinema_editor_dr", "Time_of_day", tod_preset) 
  1390. end 
  1391.  
  1392. function cinema_clip_editor_cb_av_weather(click_button, dir) 
  1393. 	local direction = dir or 0 
  1394. 	click_button:toggle_dir(direction) 
  1395. 	 
  1396. 	local weather_preset = CCE_dialogs[DLG_AV].buttons[BTN_AV_WEATHER].button:get_option_index() - 1 
  1397. 	vint_dataresponder_post("cinema_editor_dr", "Weather", weather_preset) 
  1398. end 
  1399.  
  1400. function cinema_clip_editor_cb_av_background(click_button, dir) 
  1401. 	local direction = dir or 0 
  1402. 	click_button:toggle_dir(direction) 
  1403. 	 
  1404. 	cinema_clip_editor_greenscreen_data_post() 
  1405. end 
  1406.  
  1407. function cinema_clip_editor_cb_av_vehicles(click_button, dir) 
  1408. 	local direction = dir or 0 
  1409. 	click_button:toggle_dir(direction) 
  1410. 	 
  1411. 	cinema_clip_editor_greenscreen_data_post() 
  1412. end 
  1413.  
  1414. function cinema_clip_editor_cb_av_people(click_button, dir) 
  1415. 	local direction = dir or 0 
  1416. 	click_button:toggle_dir(direction) 
  1417. 	 
  1418. 	cinema_clip_editor_greenscreen_data_post() 
  1419. end 
  1420.  
  1421. function cinema_clip_editor_cb_av_player(click_button, dir) 
  1422. 	local direction = dir or 0 
  1423. 	click_button:toggle_dir(direction) 
  1424. 	 
  1425. 	cinema_clip_editor_greenscreen_data_post() 
  1426. end 
  1427.  
  1428. function cinema_clip_editor_cb_av_sound_fx(click_button, dir) 
  1429. 	local direction = dir or 0 
  1430. 	click_button:toggle_dir(direction) 
  1431. 	 
  1432. 	local sfx = CCE_dialogs[DLG_AV].buttons[BTN_AV_SOUND_FX].button:get_option_index() - 1 
  1433. 	vint_dataresponder_post("cinema_editor_dr", "SoundFX", sfx) 
  1434. end 
  1435.  
  1436. function cinema_clip_editor_cb_av_voice(click_button, dir) 
  1437. 	local direction = dir or 0 
  1438. 	click_button:toggle_dir(direction) 
  1439. 	 
  1440. 	local voice = CCE_dialogs[DLG_AV].buttons[BTN_AV_VOICE].button:get_option_index() - 1 
  1441. 	vint_dataresponder_post("cinema_editor_dr", "Voice", voice) 
  1442. end 
  1443.  
  1444. function cinema_clip_editor_greenscreen_data_post() 
  1445. 	local gs_background = CCE_dialogs[DLG_AV].buttons[BTN_AV_BACKGROUND].button:get_option_index() - 1 
  1446. 	local gs_vehicles = CCE_dialogs[DLG_AV].buttons[BTN_AV_VEHICLES].button:get_option_index() - 1 
  1447. 	local gs_npc = CCE_dialogs[DLG_AV].buttons[BTN_AV_PEOPLE].button:get_option_index() - 1 
  1448. 	local gs_player = CCE_dialogs[DLG_AV].buttons[BTN_AV_PLAYER].button:get_option_index() - 1 
  1449. 	 
  1450. 	vint_dataresponder_post("cinema_editor_dr", "Greenscreen", gs_background, gs_vehicles, gs_npc, gs_player) 
  1451. end 
  1452.  
  1453. function cinema_clip_editor_cb_av_hide(click_button) 
  1454. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_AV]) 
  1455. 	CCE_free_buttons[BTN_FREE_AV].button:set_active() 
  1456. end 
  1457.  
  1458. -- Callback functions for buttons (Properties dialog) 
  1459. function cinema_clip_editor_cb_prop_zone_type(click_button, dir) 
  1460. 	local direction = dir or 0 
  1461. 	click_button:toggle_dir(direction) 
  1462. 	 
  1463. 	local zone = cinema_clip_editor_zone_get_current() 
  1464. 	zone.zone_type = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_ZONE_TYPE].button:get_option_index() - 1 
  1465. 	vint_dataresponder_post("camera_zone_dr", "set_type", zone.UID, zone.zone_type) 
  1466. 	 
  1467. 	local previous_zone = cinema_clip_editor_zone_get_previous() 
  1468. 	if previous_zone ~= nil then 
  1469. 		cinema_clip_editor_zone_update_blend_next() 
  1470. 		cinema_clip_editor_zone_update_visuals(previous_zone) 
  1471. 	end 
  1472. 	cinema_clip_editor_zone_update_all() 
  1473. 	cinema_clip_editor_prop_dialog_fill_data(zone) 
  1474. end 
  1475.  
  1476. function cinema_clip_editor_cb_prop_export_lock(click_button, dir) 
  1477. 	local direction = dir or 0 
  1478. 	click_button:toggle_dir(direction) 
  1479. 	 
  1480. 	local zone = cinema_clip_editor_zone_get_current() 
  1481. 	zone.export_lock =  CCE_dialogs[DLG_PROP].buttons[BTN_PROP_EXPORT_LOCK].button:get_option_index() - 1 
  1482. 	vint_dataresponder_post("camera_zone_dr", "set_export_lock", zone.UID, zone.export_lock) 
  1483. 	cinema_clip_editor_zone_update_visuals(zone) 
  1484. 	 
  1485. 	cinema_clip_editor_zone_update_all() 
  1486. end 
  1487.  
  1488. function cinema_clip_editor_cb_prop_follow_mode(click_button, dir) 
  1489. 	local direction = dir or 0 
  1490. 	click_button:toggle_dir(direction) 
  1491. 	 
  1492. 	local zone = cinema_clip_editor_zone_get_current() 
  1493. 	zone.camera_mode = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_FOLLOW].button:get_option_index() - 1 
  1494. 	vint_dataresponder_post("camera_zone_dr", "set_mode", zone.UID, zone.camera_mode) 
  1495. 	vint_dataresponder_post("camera_zone_dr", "Acquire_transform", zone.UID) 
  1496. 	 
  1497. 	cinema_clip_editor_zone_update_all() 
  1498. 	cinema_clip_editor_prop_update_dialog_general() 
  1499. end 
  1500.  
  1501. function cinema_clip_editor_cb_prop_pos_camera(click_button) 
  1502. 	if cinema_clip_editor_zone_active() ~= cinema_clip_editor_zone_highlight() then 
  1503. 		Confirm_popup:populate_list(CONFIRM_CHOICES_CAMERA, 1, CONFIRM_LIST_SIZE, 2)	 
  1504. 		Confirm_popup:set_title("PC_EDIT_WARNING") 
  1505. 		Confirm_popup:set_text("PC_EDIT_EXPLANATION") 
  1506. 		Confirm_popup:nav_enable(true, "cinema_clip_editor_pos_camera_final", "cinema_clip_editor_confirm_nav") 
  1507. 		 
  1508. 		local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1509. 		everything:set_alpha(.5) 
  1510. 		 
  1511. 		Mouse_input_tracker:subscribe(false) 
  1512. 	else  
  1513. 		cinema_clip_editor_pos_camera_go() 
  1514. 	end 
  1515. end 
  1516.  
  1517. -- Callback for checking if the user really wants to edit a non-active zone 
  1518. function cinema_clip_editor_pos_camera_final(event) 
  1519. 	if event == "back" then 
  1520. 		return 
  1521. 	end 
  1522. 	 
  1523. 	Confirm_popup:nav_enable(false, nil, nil) 
  1524. 	 
  1525. 	local everything = Vdo_base_object:new("screen_grp", 0, Cinema_clip_editor_doc_handle) 
  1526. 	everything:set_alpha(1.0) 
  1527. 	Mouse_input_tracker:subscribe(true) 
  1528. 		 
  1529. 	-- Did we select NO?  This assumes YES is the first item, NO the second 
  1530. 	if Confirm_popup:get_selected_data() ~= 1 then 
  1531. 		return 
  1532. 	end 
  1533. 	 
  1534. 	-- Actually position the camera, since we didn't go back	 
  1535. 	cinema_clip_editor_pos_camera_go() 
  1536. end 
  1537.  
  1538. -- Close the current dialog and start moving the camera 
  1539. function cinema_clip_editor_pos_camera_go() 
  1540. 	cinema_clip_editor_dialog_quick_set_and_resize(CCE_dialogs[DLG_CANCEL], "PC_POSITION_CAMERA", "PC_CAMERA_DONE", 100) 
  1541. 	cinema_clip_editor_dialog_show(CCE_dialogs[DLG_CANCEL]) 
  1542. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_PROP]) 
  1543. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_CAMERA_ZONE]) 
  1544. 	CCE_dialogs[DLG_CANCEL].buttons[1].button:set_visible(false) 
  1545. 	 
  1546. 	vint_dataresponder_post("cinema_editor_dr", "control_mode", 1) 
  1547. 	Acquire_something = true 
  1548. 	Acquire_target = false 
  1549. end 
  1550.  
  1551. function cinema_clip_editor_cb_prop_target(click_button, dir, dir) 
  1552. 	local direction = dir or 0 
  1553. 	click_button:toggle_dir(direction) 
  1554. 	 
  1555. 	-- TODO: Change this to a filter, or remove it 
  1556. end 
  1557.  
  1558. function cinema_clip_editor_cb_prop_choose_target(click_button) 
  1559. 	cinema_clip_editor_dialog_quick_set_and_resize(CCE_dialogs[DLG_CANCEL], "PC_SELECT_TARGET", "PC_CAMERA_DONE", 100) 
  1560. 	cinema_clip_editor_dialog_show(CCE_dialogs[DLG_CANCEL]) 
  1561. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_PROP]) 
  1562. 	CCE_dialogs[DLG_CANCEL].buttons[1].button:set_visible(false) 
  1563. 	 
  1564. 	vint_dataresponder_post("cinema_editor_dr", "control_mode", 1) 
  1565. 	Acquire_something = true 
  1566. 	Acquire_target = true 
  1567. end 
  1568.  
  1569. function cinema_clip_editor_cb_prop_field_of_view(click_button) 
  1570. 	local zone = cinema_clip_editor_zone_get_current() 
  1571. 	zone.fov = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_FOV].button.s_value 
  1572. 	vint_dataresponder_post("camera_zone_dr", "set_fov", zone.UID, zone.fov, zone.fov_blend) 
  1573. end 
  1574.  
  1575. function cinema_clip_editor_cb_prop_camera_tilt(click_button) 
  1576. 	local zone = cinema_clip_editor_zone_get_current() 
  1577. 	zone.tilt = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_TILT].button.s_value 
  1578. 	vint_dataresponder_post("camera_zone_dr", "set_tilt", zone.UID, zone.tilt, zone.tilt_blend) 
  1579. end 
  1580.  
  1581. function cinema_clip_editor_cb_prop_handycam(click_button) 
  1582. 	local zone = cinema_clip_editor_zone_get_current() 
  1583. 	zone.handycam = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_HANDYCAM].button.s_value 
  1584. 	vint_dataresponder_post("camera_zone_dr", "set_handycam", zone.UID, zone.handycam, zone.handycam_blend) 
  1585. end 
  1586.  
  1587. function cinema_clip_editor_cb_prop_slow_mo(click_button, dir) 
  1588. 	local direction = dir or 0 
  1589. 	click_button:toggle_dir(direction) 
  1590. 	 
  1591. 	local zone = cinema_clip_editor_zone_get_current() 
  1592. 	zone.slow_mo = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_SLOW_MO].button:get_option_index() - 1 
  1593. 	vint_dataresponder_post("camera_zone_dr", "set_slow_motion", zone.UID, zone.slow_mo) 
  1594. 	cinema_clip_editor_zone_update_all() 
  1595. end 
  1596.  
  1597. function cinema_clip_editor_cb_prop_depth_of_field(click_button, dir) 
  1598. 	local direction = dir or 0 
  1599. 	click_button:toggle_dir(direction) 
  1600. 	 
  1601. 	local zone = cinema_clip_editor_zone_get_current() 
  1602. 	zone.dof_mode = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_DOF].button:get_option_index() - 1 
  1603. 	vint_dataresponder_post("camera_zone_dr", "set_dof_params", zone.UID, zone.dof_mode, zone.dof_dist, zone.dof_dist_blend, zone.dof_focal, zone.dof_focal_blend) 
  1604. 	 
  1605. 	cinema_clip_editor_zone_update_all() 
  1606. 	cinema_clip_editor_prop_update_dialog_general() 
  1607. end 
  1608.  
  1609. function cinema_clip_editor_cb_prop_dof_distance(click_button) 
  1610. 	local zone = cinema_clip_editor_zone_get_current() 
  1611. 	zone.dof_dist = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_DOF_DIST].button.s_value 
  1612. 	vint_dataresponder_post("camera_zone_dr", "set_dof_params", zone.UID, zone.dof_mode, zone.dof_dist, zone.dof_dist_blend, zone.dof_focal, zone.dof_focal_blend) 
  1613. end 
  1614.  
  1615. function cinema_clip_editor_cb_prop_dof_focal_range(click_button) 
  1616. 	local zone = cinema_clip_editor_zone_get_current() 
  1617. 	zone.dof_focal = CCE_dialogs[DLG_PROP].buttons[BTN_PROP_DOF_FOCAL].button.s_value 
  1618. 	vint_dataresponder_post("camera_zone_dr", "set_dof_params", zone.UID, zone.dof_mode, zone.dof_dist, zone.dof_dist_blend, zone.dof_focal, zone.dof_focal_blend) 
  1619. end 
  1620.  
  1621. function cinema_clip_editor_cb_prop_hide(click_button) 
  1622. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_PROP]) 
  1623. 	cinema_clip_editor_dialog_show(CCE_dialogs[DLG_CAMERA_ZONE]) 
  1624. end 
  1625.  
  1626. -- Callback functions for buttons (Blend buttons on the Properties dialog) 
  1627. function cinema_clip_editor_cb_blend_cam_position(click_button) 
  1628. 	click_button:toggle_ease() 
  1629. 	local zone = cinema_clip_editor_zone_get_current() 
  1630. 	zone.camera_blend =  CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_POSITION].button.icon_num - PC_ICON_EASE_NONE 
  1631. 	vint_dataresponder_post("camera_zone_dr", "set_transform_blend", zone.UID, zone.camera_blend) 
  1632. end 
  1633.  
  1634. function cinema_clip_editor_cb_blend_dof_distance(click_button) 
  1635. 	click_button:toggle_ease() 
  1636. 	local zone = cinema_clip_editor_zone_get_current() 
  1637. 	zone.dof_dist_blend =  CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_DOF_DIST].button.icon_num - PC_ICON_EASE_NONE 
  1638. 	vint_dataresponder_post("camera_zone_dr", "set_dof_params", zone.UID, zone.dof_mode, zone.dof_dist, zone.dof_dist_blend, zone.dof_focal, zone.dof_focal_blend) 
  1639. end 
  1640.  
  1641. function cinema_clip_editor_cb_blend_dof_focal_range(click_button) 
  1642. 	click_button:toggle_ease() 
  1643. 	local zone = cinema_clip_editor_zone_get_current() 
  1644. 	zone.dof_focal_blend =  CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_DOF_FOCAL].button.icon_num - PC_ICON_EASE_NONE 
  1645. 	vint_dataresponder_post("camera_zone_dr", "set_dof_params", zone.UID, zone.dof_mode, zone.dof_dist, zone.dof_dist_blend, zone.dof_focal, zone.dof_focal_blend) 
  1646. end 
  1647.  
  1648. function cinema_clip_editor_cb_blend_fov(click_button) 
  1649. 	click_button:toggle_ease() 
  1650. 	local zone = cinema_clip_editor_zone_get_current() 
  1651. 	zone.fov_blend = CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_FOV].button.icon_num - PC_ICON_EASE_NONE 
  1652. 	vint_dataresponder_post("camera_zone_dr", "set_fov", zone.UID, zone.fov, zone.fov_blend) 
  1653. end 
  1654.  
  1655. function cinema_clip_editor_cb_blend_cam_tilt(click_button) 
  1656. 	click_button:toggle_ease() 
  1657. 	local zone = cinema_clip_editor_zone_get_current() 
  1658. 	zone.tilt_blend = CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_TILT].button.icon_num - PC_ICON_EASE_NONE 
  1659. 	vint_dataresponder_post("camera_zone_dr", "set_tilt", zone.UID, zone.tilt, zone.tilt_blend) 
  1660. end 
  1661.  
  1662. function cinema_clip_editor_cb_blend_handycam(click_button) 
  1663. 	click_button:toggle_ease()	 
  1664. 	local zone = cinema_clip_editor_zone_get_current() 
  1665. 	zone.handycam_blend = CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_FOV].button.icon_num - PC_ICON_EASE_NONE 
  1666. 	vint_dataresponder_post("camera_zone_dr", "set_handycam", zone.UID, zone.handycam, zone.handycam_blend) 
  1667. end 
  1668.  
  1669. -- Utility functions for the properties dialog 
  1670.  
  1671. -- Update stuff that enables/disables/hides other parts of the dialog 
  1672. function cinema_clip_editor_prop_update_dialog_general() 
  1673. 	-- Turn everything on by default, hide ease buttons by default 
  1674. 	-- Enable and hide the ease buttons 
  1675. 	for i = 1, #CCE_dialogs[DLG_PROP].ease_buttons do 
  1676. 		CCE_dialogs[DLG_PROP].ease_buttons[i].button:set_visible(false) 
  1677. 		CCE_dialogs[DLG_PROP].ease_buttons[i].button:set_active() 
  1678. 	end 
  1679. 	-- Enable properties dialog buttons 
  1680. 	for i = 1, CCE_dialogs[DLG_PROP].num_buttons do 
  1681. 		CCE_dialogs[DLG_PROP].buttons[i].button:set_active() 
  1682. 	end 
  1683. 	-- Enable the camera zone dialog buttons 
  1684. 	for i = 1, CCE_dialogs[DLG_CAMERA_ZONE].num_buttons do 
  1685. 		CCE_dialogs[DLG_CAMERA_ZONE].buttons[i].button:set_active() 
  1686. 	end 
  1687. 	 
  1688. 	-- Get the zone (keep in mind all zone data is 0-based, not 1-based) 
  1689. 	local zone = cinema_clip_editor_zone_get_current() 
  1690. 	local no_editing = false 
  1691. 	 
  1692. 	-- If beginner mode is on, don't allow editing of non-active zones 
  1693. 	if CCE_option_beginner_mode == true then 
  1694. 		if cinema_clip_editor_zone_highlight() ~= cinema_clip_editor_zone_active() then 
  1695. 			no_editing = true 
  1696. 		end 
  1697. 	end 
  1698.  
  1699. 	if zone ~= nil then 
  1700. 		-- Depth of field sliders - disable if DOF is off 
  1701. 		if zone.dof_mode == 0 then -- 0 = OFF 
  1702. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_DOF_DIST].button:set_inactive() 
  1703. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_DOF_FOCAL].button:set_inactive() 
  1704. 			CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_DOF_DIST].button:set_inactive() 
  1705. 			CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_DOF_FOCAL].button:set_inactive() 
  1706. 		end 
  1707. 			 
  1708. 		-- Blending on disables some buttons, unhides ease buttons 
  1709. 		if zone.zone_type == 1 then -- 1 = BLEND 
  1710. 			cinema_clip_editor_prop_update_dialog_zone_blend() 
  1711. 		end	 
  1712. 		 
  1713. 		-- Camera_mode disables some buttons for certain types 
  1714. 		if zone.camera_mode == 0 then -- { "DEFAULT", "STATIC", "FOLLOW", "FOLLOW LOOK", "FOLLOW WATCH", "TRACKING" } 
  1715. 			CCE_dialogs[DLG_CAMERA_ZONE].buttons[BTN_CZ_POS_CAMERA].button:set_inactive() 
  1716. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_POS_CAMERA].button:set_inactive() 
  1717. 			CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_POSITION].button:set_inactive() 
  1718. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_SELECT_TARGET].button:set_inactive() 
  1719. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_TILT].button:set_inactive() 
  1720. 			CCE_dialogs[DLG_PROP].ease_buttons[BTN_EASE_TILT].button:set_inactive() 
  1721. 		elseif zone.camera_mode == 1 then 
  1722. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_SELECT_TARGET].button:set_inactive() 
  1723. 		end 
  1724. 		 
  1725. 		-- If this is the first zone, disable type 
  1726. 		if zone.index == 1 then 
  1727. 			CCE_dialogs[DLG_PROP].buttons[BTN_PROP_ZONE_TYPE].button:set_inactive() 
  1728. 		end 
  1729. 		 
  1730. 		-- If it's the last zone, disable copy next 
  1731. 		if Num_zones == zone.index then 
  1732. 			CCE_dialogs[DLG_CAMERA_ZONE].buttons[BTN_CZ_COPY_NEXT].button:set_inactive() 
  1733. 		end 
  1734. 		 
  1735. 		if no_editing == true then 
  1736. 			CCE_dialogs[DLG_CAMERA_ZONE].buttons[BTN_CZ_POS_CAMERA].button:set_inactive() 
  1737. 			CCE_dialogs[DLG_CAMERA_ZONE].buttons[BTN_CZ_EDIT_PROPERTIES].button:set_inactive() 
  1738. 		end 
  1739. 	end 
  1740. end 
  1741.  
  1742. -- Update the properties dialog when the ZONE TYPE is set to BLEND 
  1743. function cinema_clip_editor_prop_update_dialog_zone_blend() 
  1744. 	-- Unhide the ease buttons 
  1745. 	for i = 1, #CCE_dialogs[DLG_PROP].ease_buttons do 
  1746. 		CCE_dialogs[DLG_PROP].ease_buttons[i].button:set_visible(true) 
  1747. 	end 
  1748. 	-- Disable the buttons without ease buttons 
  1749. 	for i = BTN_PROP_EXPORT_LOCK, BTN_PROP_SELECT_TARGET do 
  1750. 		CCE_dialogs[DLG_PROP].buttons[i].button:set_inactive() 
  1751. 	end 
  1752. 	for i = BTN_PROP_SLOW_MO, BTN_PROP_DOF do 
  1753. 		CCE_dialogs[DLG_PROP].buttons[i].button:set_inactive() 
  1754. 	end 
  1755. end 
  1756.  
  1757.  
  1758. -- Callback function for button (Cancel dialog) 
  1759. function cinema_clip_editor_cb_cancel(click_button) 
  1760. 	cinema_clip_editor_dialog_hide(CCE_dialogs[DLG_CANCEL]) 
  1761. 	Hint_bar:set_visible(false) 
  1762. 	 
  1763. 	local zone = cinema_clip_editor_zone_get_current() 
  1764. 	vint_dataresponder_post("cinema_editor_dr", "control_mode", 0) 
  1765. 	if Acquire_target then 
  1766. 		vint_dataresponder_post("camera_zone_dr", "set_target", zone.UID) 
  1767. 	else 
  1768. 		vint_dataresponder_post("camera_zone_dr", "Acquire_transform", zone.UID) 
  1769. 	end 
  1770. 	Acquire_something = false 
  1771. end 
  1772.  
  1773. -- Fill the zone properties dialog with data from the zone 
  1774. function cinema_clip_editor_prop_dialog_fill_data(zone) 
  1775. 	if zone ~= nil then 
  1776. 		local dialog = CCE_dialogs[DLG_PROP] 
  1777. 		 
  1778. 		-- Toggle properties 
  1779. 		dialog.buttons[BTN_PROP_ZONE_TYPE].button:set_option_index(zone.zone_type + 1) 
  1780. 		dialog.buttons[BTN_PROP_EXPORT_LOCK].button:set_option_index(zone.export_lock + 1) 
  1781. 		dialog.buttons[BTN_PROP_FOLLOW].button:set_option_index(zone.camera_mode + 1) 
  1782. 		dialog.buttons[BTN_PROP_SLOW_MO].button:set_option_index(zone.slow_mo + 1) 
  1783. 		dialog.buttons[BTN_PROP_DOF].button:set_option_index(zone.dof_mode + 1) 
  1784. 		 
  1785. 		-- Slider properties 
  1786. 		dialog.buttons[BTN_PROP_FOV].button:set_slider_value(zone.fov) 
  1787. 		dialog.buttons[BTN_PROP_TILT].button:set_slider_value(zone.tilt) 
  1788. 		dialog.buttons[BTN_PROP_HANDYCAM].button:set_slider_value(zone.handycam) 
  1789. 		dialog.buttons[BTN_PROP_DOF_DIST].button:set_slider_value(zone.dof_dist) 
  1790. 		dialog.buttons[BTN_PROP_DOF_FOCAL].button:set_slider_value(zone.dof_focal) 
  1791. 		 
  1792. 		-- Ease properties 
  1793. 		dialog.ease_buttons[BTN_EASE_POSITION].button:set_icon(PC_ICON_EASE_NONE + zone.camera_blend) 
  1794. 		dialog.ease_buttons[BTN_EASE_FOV].button:set_icon(PC_ICON_EASE_NONE + zone.fov_blend) 
  1795. 		dialog.ease_buttons[BTN_EASE_TILT].button:set_icon(PC_ICON_EASE_NONE + zone.tilt_blend) 
  1796. 		dialog.ease_buttons[BTN_EASE_HANDYCAM].button:set_icon(PC_ICON_EASE_NONE + zone.handycam_blend) 
  1797. 		dialog.ease_buttons[BTN_EASE_DOF_DIST].button:set_icon(PC_ICON_EASE_NONE + zone.dof_dist_blend) 
  1798. 		dialog.ease_buttons[BTN_EASE_DOF_FOCAL].button:set_icon(PC_ICON_EASE_NONE + zone.dof_focal_blend) 
  1799. 	end 
  1800. 	 
  1801. 	cinema_clip_editor_prop_update_dialog_general() 
  1802. end 
  1803.  
  1804. function cinema_clip_editor_options_dialog_fill_data() 
  1805. 	vint_dataresponder_request("cinema_editor_dr", "cinema_clip_editor_update_options", 0) 
  1806. end 
  1807.  
  1808. function cinema_clip_editor_av_dialog_fill_data() 
  1809. 	vint_dataresponder_request("cinema_editor_dr", "cinema_clip_editor_update_options", 0) 
  1810. end 
  1811.  
  1812. function cinema_clip_editor_update_options(output_only, watermark, tod, weather, gs_background, gs_vehicle, gs_npc, gs_player, sfx, voice, clip_time) 
  1813. 	local dialog = CCE_dialogs[DLG_OPTIONS] 
  1814. 	 
  1815. 	-- TODO: Add other options as they are added in code 
  1816. 	--dialog.buttons[BTN_OPT_OUTPUT].button:set_option_index(output_only + 1) 
  1817. 	--dialog.buttons[BTN_OPT_WATERMARK].button:set_option_index(watermark + 1) 
  1818. 	 
  1819. 	dialog = CCE_dialogs[DLG_AV] 
  1820. 	dialog.buttons[BTN_AV_TIME_OF_DAY].button:set_option_index(tod + 1) 
  1821. 	dialog.buttons[BTN_AV_WEATHER].button:set_option_index(weather + 1) 
  1822. 	dialog.buttons[BTN_AV_BACKGROUND].button:set_option_index(gs_background + 1) 
  1823. 	dialog.buttons[BTN_AV_VEHICLES].button:set_option_index(gs_vehicle + 1) 
  1824. 	dialog.buttons[BTN_AV_PEOPLE].button:set_option_index(gs_npc + 1) 
  1825. 	dialog.buttons[BTN_AV_PLAYER].button:set_option_index(gs_player + 1) 
  1826. 	dialog.buttons[BTN_AV_SOUND_FX].button:set_option_index(sfx + 1) 
  1827. 	dialog.buttons[BTN_AV_VOICE].button:set_option_index(voice + 1) 
  1828. 	 
  1829. 	Timeline_time_end = clip_time 
  1830. end 
  1831.  
  1832. -- Dialog defines 
  1833. DLG_CAMERA_ZONE = 1 
  1834. DLG_OPTIONS = 2 
  1835. DLG_AV = 3 
  1836. DLG_PROP = 4 
  1837. DLG_CANCEL = 5 
  1838.  
  1839. -- Dialog button defines 
  1840. -- Camera zone buttons 
  1841. BTN_CZ_EDIT_PROPERTIES = 1 
  1842. BTN_CZ_POS_CAMERA = 2 
  1843. BTN_CZ_DELETE = 3 
  1844. BTN_CZ_COPY_CURRENT = 4 
  1845. BTN_CZ_COPY_NEXT = 5 
  1846. BTN_CZ_EXIT = 6 
  1847.  
  1848. -- Options buttons 
  1849. BTN_OPT_ADVANCED = 1 
  1850. BTN_OPT_ROTATION = 2 
  1851. BTN_OPT_MOVEMENT = 3 
  1852. --BTN_OPT_OUTPUT = 4 
  1853. --BTN_OPT_WATERMARK = 5 
  1854. --BTN_OPT_CREATE = 6 
  1855. --BTN_OPT_LOAD_DEFAULT = 7 
  1856. BTN_OPT_EXIT = 4 
  1857.  
  1858. -- AV buttons 
  1859. BTN_AV_TIME_OF_DAY = 1 
  1860. BTN_AV_WEATHER = 2 
  1861. BTN_AV_BACKGROUND = 3 
  1862. BTN_AV_VEHICLES = 4 
  1863. BTN_AV_PEOPLE = 5 
  1864. BTN_AV_PLAYER = 6 
  1865. BTN_AV_SOUND_FX = 7 
  1866. BTN_AV_VOICE = 8 
  1867. BTN_AV_EXIT = 9 
  1868.  
  1869. -- Properties buttons 
  1870. BTN_PROP_ZONE_TYPE = 1 
  1871. BTN_PROP_EXPORT_LOCK = 2 
  1872. BTN_PROP_FOLLOW = 3 
  1873. --BTN_PROP_TARGET = 4 
  1874. BTN_PROP_SELECT_TARGET = 4 
  1875. BTN_PROP_POS_CAMERA = 5 
  1876. BTN_PROP_SLOW_MO = 6 
  1877. BTN_PROP_DOF = 7 
  1878. BTN_PROP_DOF_DIST = 8 
  1879. BTN_PROP_DOF_FOCAL = 9 
  1880. BTN_PROP_FOV = 10 
  1881. BTN_PROP_TILT = 11 
  1882. BTN_PROP_HANDYCAM = 12 
  1883. BTN_PROP_EXIT = 13 
  1884.  
  1885. -- Ease buttons (for the properties dialog) 
  1886. BTN_EASE_POSITION = 1 
  1887. BTN_EASE_DOF_DIST = 2 
  1888. BTN_EASE_DOF_FOCAL = 3 
  1889. BTN_EASE_FOV = 4 
  1890. BTN_EASE_TILT = 5 
  1891. BTN_EASE_HANDYCAM = 6 
  1892.  
  1893. -- Cancel buttons 
  1894. BTN_CNCL_DONE = 1 
  1895. BTN_CNCL_EXIT = 2 
  1896.  
  1897.  -- List of dialogs, including their buttons 
  1898. CCE_dialogs = { 
  1899. 	[DLG_CAMERA_ZONE] = { 
  1900. 		bg = nil,	-- Background image object (filled during init) 
  1901. 		text = nil, -- Text object (filled during init) 
  1902. 		hide = nil,  -- Hide button (X in upper right) 
  1903. 		title = "PC_CAMERA_ZONE", 
  1904. 		x_pos = 0, 
  1905. 		width = 200, 
  1906. 		value_width = 0, 
  1907. 		num_buttons = 5, -- Not counting the hide button 
  1908. 		buttons = { 
  1909. 			[BTN_CZ_EDIT_PROPERTIES] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_EDIT_PROPERTIES", tooltip = "PC_EDIT_PROPS_HINT", }, callback = cinema_clip_editor_cb_cz_edit_properties, }, 
  1910. 			[BTN_CZ_POS_CAMERA] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_POSITION_CAMERA", tooltip = "PC_POSITION_CAMERA_HINT", }, callback = cinema_clip_editor_cb_prop_pos_camera, }, 
  1911. 			[BTN_CZ_DELETE] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_DELETE_CZ", tooltip = "PC_DELETE_CZ_HINT", }, callback = cinema_clip_editor_cb_cz_delete, }, 
  1912. 			[BTN_CZ_COPY_CURRENT] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_COPY_CURRENT", tooltip = "PC_COPY_CURRENT_HINT", }, callback = cinema_clip_editor_cb_cz_copy_current, }, 
  1913. 			[BTN_CZ_COPY_NEXT] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_COPY_NEXT", tooltip = "PC_COPY_NEXT_HINT", }, callback = cinema_clip_editor_cb_cz_copy_next, }, 
  1914. 			[BTN_CZ_EXIT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXIT, mini = true, tooltip = "PC_CZ_EXIT_HINT", }, callback = cinema_clip_editor_cb_cz_hide, }, -- Created by dialog 
  1915. 		},	-- Buttons 
  1916. 		num_headings = 0, -- Incremented dynamically (see cinema_clip_editor_dialog_add_heading) 
  1917. 		headings = {}, -- List of headings (text) 
  1918. 		spacers = {},  -- List of heading positions 
  1919. 		ease_buttons = nil, -- See DLG_PROP for how this is used 
  1920. 		visible = false, -- Whether the dialog is visible 
  1921. 	}, 
  1922. 	[DLG_OPTIONS] = { 
  1923. 		bg = nil, 
  1924. 		text = nil, 
  1925. 		hide = nil, 
  1926. 		title = "PC_OPTIONS", 
  1927. 		x_pos = 0, 
  1928. 		width = 300, 
  1929. 		value_width = 120, 
  1930. 		num_buttons = 3, 
  1931. 		buttons = { 
  1932. 			[BTN_OPT_ADVANCED] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_ADVANCED_MODE", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_ADVANCED_MODE_HINT", }, callback = cinema_clip_editor_cb_opt_advanced, }, 
  1933. 			[BTN_OPT_ROTATION] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_ROTATION_SENSITIVITY", s_min = 25, s_max = 100, s_step = 10, s_snap = 5, s_value = 50, tooltip = "PC_ROTATION_SENSITIVITY_HINT", }, callback = cinema_clip_editor_cb_opt_rotation_sens, }, 
  1934. 			[BTN_OPT_MOVEMENT] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_MOVEMENT_SENSITIVITY", s_min = 25, s_max = 100, s_step = 10, s_snap = 5, s_value = 50, tooltip = "PC_MOVEMENT_SENSITIVITY_HINT", }, callback = cinema_clip_editor_cb_opt_movement_sens, }, 
  1935. 			--[BTN_OPT_OUTPUT] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_OUTPUT_ONLY", options = { "OPTION_NO", "OPTION_YES" }, o_index = 1, tooltip = "PC_OUTPUT_ONLY_HINT", }, callback = cinema_clip_editor_cb_opt_show_output, }, 
  1936. 			--[BTN_OPT_WATERMARK] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_WATERMARK", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_WATERMARK_HINT", }, callback = cinema_clip_editor_cb_opt_watermark, }, 
  1937. 			--[BTN_OPT_CREATE] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_CREATE_CHAR", tooltip = "PC_CREATE_CHAR_HINT", }, callback = cinema_clip_editor_cb_opt_create_import, }, 
  1938. 			--[BTN_OPT_LOAD_DEFAULT] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_LOAD_CHAR", tooltip = "PC_LOAD_CHAR_HINT", }, callback = cinema_clip_editor_cb_opt_load_default, }, 
  1939. 			[BTN_OPT_EXIT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXIT, mini = true, tooltip = "PC_OPTIONS_EXIT_HINT", }, callback = cinema_clip_editor_cb_opt_hide, }, -- Created by dialog 
  1940. 		}, 
  1941. 		num_headings = 0, 
  1942. 		headings = {}, 
  1943. 		spacers = {}, 
  1944. 		ease_buttons = nil, 
  1945. 		visible = false, 
  1946. 	}, 
  1947. 	[DLG_AV] = { 
  1948. 		bg = nil, 
  1949. 		text = nil, 
  1950. 		hide = nil, 
  1951. 		title = "PC_ENVIRONMENT", 
  1952. 		x_pos = 0, 
  1953. 		width = 300, 
  1954. 		value_width = 120, 
  1955. 		num_buttons = 8, 
  1956. 		buttons = { 
  1957. 			[BTN_AV_TIME_OF_DAY] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_TOD", options = { "PC_TOD_DEFAULT", "PC_TOD_MORNING", "PC_TOD_NOON", "PC_TOD_AFTERNOON", "PC_TOD_NIGHT" }, o_index = 2, tooltip = "PC_TOD_HINT", }, callback = cinema_clip_editor_cb_av_time_of_day, }, 
  1958. 			[BTN_AV_WEATHER] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_WEATHER", options = { "PC_W_DEFAULT", "PC_W_CLEAR", "PC_W_OVERCAST", "PC_W_RAINY", "PC_W_THUNDERSTORM" }, o_index = 1, tooltip = "PC_WEATHER_HINT", }, callback = cinema_clip_editor_cb_av_weather, }, 
  1959. 			[BTN_AV_BACKGROUND] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_GS_BACKGROUND", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_GS_BACKGROUND_HINT", }, callback = cinema_clip_editor_cb_av_background, }, 
  1960. 			[BTN_AV_VEHICLES] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_GS_VEHICLES", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_GS_VEHICLES_HINT", }, callback = cinema_clip_editor_cb_av_vehicles, }, 
  1961. 			[BTN_AV_PEOPLE] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_GS_PEOPLE", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_GS_PEOPLE_HINT", }, callback = cinema_clip_editor_cb_av_people, }, 
  1962. 			[BTN_AV_PLAYER] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_GS_PLAYER", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_GS_PLAYER_HINT", }, callback = cinema_clip_editor_cb_av_player, }, 
  1963. 			[BTN_AV_SOUND_FX] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_SOUNDFX", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_SOUNDFX_HINT", }, callback = cinema_clip_editor_cb_av_sound_fx, }, 
  1964. 			[BTN_AV_VOICE] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_VOICE", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_VOICE_HINT", }, callback = cinema_clip_editor_cb_av_voice, }, 
  1965. 			[BTN_AV_EXIT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXIT, mini = true, tooltip = "PC_AV_EXIT_HINT", }, callback = cinema_clip_editor_cb_av_hide, }, -- Created by dialog 
  1966. 		}, 
  1967. 		num_headings = 0, 
  1968. 		headings = {}, 
  1969. 		spacers = {}, 
  1970. 		ease_buttons = nil, 
  1971. 		visible = false, 
  1972. 	}, 
  1973. 	[DLG_PROP] = { 
  1974. 		bg = nil, 
  1975. 		text = nil, 
  1976. 		hide = nil, 
  1977. 		title = "PC_PROPS", 
  1978. 		x_pos = 0, 
  1979. 		width = 300, 
  1980. 		value_width = 120, 
  1981. 		num_buttons = 12, 
  1982. 		buttons = { 
  1983. 			[BTN_PROP_ZONE_TYPE] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_ZONE_TYPE", options = { "PC_ZT_CUT", "PC_ZT_BLEND" }, o_index = 1, tooltip = "PC_ZONE_TYPE_HINT", }, callback = cinema_clip_editor_cb_prop_zone_type, }, 
  1984. 			[BTN_PROP_EXPORT_LOCK] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_EXPORT_LOCK", options = { "OPTION_NO", "OPTION_YES" }, o_index = 2, tooltip = "PC_EXPORT_LOCK_HINT", }, callback = cinema_clip_editor_cb_prop_export_lock, }, 
  1985. 			[BTN_PROP_FOLLOW] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_CAM_MODE", options = { "PC_CM_DEFAULT", "PC_CM_STATIC", "PC_CM_FOLLOW", "PC_CM_FOLLOW_LOOK", "PC_CM_FOLLOW_WATCH", "PC_CM_TRACKING" }, o_index = 1, tooltip = "PC_CAM_MODE_HINT", }, callback = cinema_clip_editor_cb_prop_follow_mode, }, 
  1986. 			--[BTN_PROP_TARGET] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "BLANK", options = { "BLANK" }, o_index = 1, tooltip = "REMOVE THIS OPTION?", }, callback = cinema_clip_editor_cb_prop_target, }, 
  1987. 			[BTN_PROP_SELECT_TARGET] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_SELECT_TARGET", tooltip = "PC_SELECT_TARGET_HINT", }, callback = cinema_clip_editor_cb_prop_choose_target, }, 
  1988. 			[BTN_PROP_POS_CAMERA] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_POSITION_CAMERA", tooltip = "PC_POSITION_CAMERA_HINT", }, callback = cinema_clip_editor_cb_prop_pos_camera, }, 
  1989. 			[BTN_PROP_SLOW_MO] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_SLOWMO", options = { "PC_SM_NORMAL", "PC_SM_SLOW", "PC_SM_VERY_SLOW", "PC_SM_VERY_FAST", "PC_SM_FAST", }, o_index = 1, tooltip = "PC_SLOWMO_HINT", }, callback = cinema_clip_editor_cb_prop_slow_mo, }, 
  1990. 			[BTN_PROP_DOF] = { button = nil, data = { type = PC_TYPE_TOGGLE, label = "PC_DOF", options = { "PC_DOF_OFF", "PC_DOF_ZOOM", "PC_DOF_CLOSEUP", "PC_DOF_NORMAL", "PC_DOF_WIDE", }, o_index = 4, tooltip = "PC_DOF_HINT", }, callback = cinema_clip_editor_cb_prop_depth_of_field, }, 
  1991. 			[BTN_PROP_DOF_DIST] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_DOF_DIST", s_min = 0, s_max = 100, s_step = 10, s_snap = 5, s_value = 50, tooltip = "PC_DOF_DIST_HINT", }, callback = cinema_clip_editor_cb_prop_dof_distance, }, 
  1992. 			[BTN_PROP_DOF_FOCAL] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_DOF_RANGE", s_min = 0, s_max = 100, s_step = 10, s_snap = 5, s_value = 50, tooltip = "PC_DOF_RANGE_HINT", }, callback = cinema_clip_editor_cb_prop_dof_focal_range, }, 
  1993. 			[BTN_PROP_FOV] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_FOV", s_min = 10, s_max = 120, s_step = 5, s_snap = 5, s_value = 60, tooltip = "PC_FOV_HINT", }, callback = cinema_clip_editor_cb_prop_field_of_view, }, 
  1994. 			[BTN_PROP_TILT] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_CAM_TILT", s_min = -180, s_max = 180, s_step = 5, s_snap = 5, s_value = 0, tooltip = "PC_CAM_TILT_HINT", }, callback = cinema_clip_editor_cb_prop_camera_tilt, }, 
  1995. 			[BTN_PROP_HANDYCAM] = { button = nil, data = { type = PC_TYPE_SLIDER, label = "PC_HANDYCAM", s_min = 0, s_max = 100, s_step = 10, s_snap = 5, s_value = 0, tooltip = "PC_HANDYCAM_HINT", }, callback = cinema_clip_editor_cb_prop_handycam, }, 
  1996. 			[BTN_PROP_EXIT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXIT, mini = true, tooltip = "PC_PROPS_EXIT_HINT", }, callback = cinema_clip_editor_cb_prop_hide, }, -- Created by dialog 
  1997. 		}, 
  1998. 		num_headings = 0, 
  1999. 		headings = {}, 
  2000. 		spacers = {}, 
  2001. 		visible = false, 
  2002. 		-- These buttons are used only in this specific dialog 
  2003. 		ease_buttons = {  
  2004. 			[BTN_EASE_POSITION] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EASE_NONE, mini = false, tooltip = "PC_EASE_HINT", }, callback = cinema_clip_editor_cb_blend_cam_position, }, 
  2005. 			[BTN_EASE_DOF_DIST] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EASE_NONE, mini = false, tooltip = "PC_EASE_HINT", }, callback = cinema_clip_editor_cb_blend_dof_distance, }, 
  2006. 			[BTN_EASE_DOF_FOCAL] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EASE_NONE, mini = false, tooltip = "PC_EASE_HINT", }, callback = cinema_clip_editor_cb_blend_dof_focal_range, }, 
  2007. 			[BTN_EASE_FOV] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EASE_NONE, mini = false, tooltip = "PC_EASE_HINT", }, callback = cinema_clip_editor_cb_blend_fov, }, 
  2008. 			[BTN_EASE_TILT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EASE_NONE, mini = false, tooltip = "PC_EASE_HINT", }, callback = cinema_clip_editor_cb_blend_cam_tilt, }, 
  2009. 			[BTN_EASE_HANDYCAM] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EASE_NONE, mini = false, tooltip = "PC_EASE_HINT", }, callback = cinema_clip_editor_cb_blend_handycam, }, 
  2010. 		},  
  2011. 		ease_lines = { 5, 8, 9, 10, 11, 12 }, -- Which dialog buttons to line up with 
  2012. 		ease_headers = { 0, 1, 1, 1, 1, 1 }, -- How many sub-headers to offset by for each ease button 
  2013. 	}, 
  2014. 	[DLG_CANCEL] = { 
  2015. 		bg = nil, 
  2016. 		text = nil, 
  2017. 		hide = nil, 
  2018. 		title = "PC_POSITION_CAMERA", 
  2019. 		x_pos = 1280 * 0.5, 
  2020. 		width = 100, 
  2021. 		value_width = 0, 
  2022. 		num_buttons = 1, 
  2023. 		buttons = { 
  2024. 			[BTN_CNCL_DONE] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_CAMERA_DONE", tooltip = "PC_CAMERA_DONE_HINT", }, callback = cinema_clip_editor_cb_cancel, }, 
  2025. 			[BTN_CNCL_EXIT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXIT, mini = true, tooltip = "PC_CAMERA_DONE_HINT", }, callback = cinema_clip_editor_cb_cancel, }, -- Created by dialog, does same thing as main button (currently) 
  2026. 		}, 
  2027. 		num_headings = 0, 
  2028. 		headings = {}, 
  2029. 		spacers = {}, 
  2030. 		ease_buttons = nil, 
  2031. 		visible = false, 
  2032. 	}, 
  2033. } 
  2034.  
  2035. -- Non-dialog button defines 
  2036. BTN_FREE_REWIND = 1 
  2037. BTN_FREE_PLAY_SLOW = 2 
  2038. BTN_FREE_PLAY = 3 
  2039. BTN_FREE_PLAY_FAST = 4 
  2040. BTN_FREE_PAUSE = 5 
  2041. BTN_FREE_OPTIONS = 6 
  2042. BTN_FREE_AV = 7 
  2043. BTN_FREE_SAVE = 8 
  2044. BTN_FREE_EXPORT = 9 
  2045. BTN_FREE_EXIT = 10 
  2046. BTN_FREE_SHOW_KEYS = 11 
  2047. BTN_FREE_HIDE_HUD = 12 
  2048. BTN_FREE_SHOW_HUD = 13 
  2049.  
  2050. -- Buttons not associated with a dialog 
  2051. CCE_free_buttons = { 
  2052. 	-- Top row 
  2053. 	[BTN_FREE_REWIND] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_REWIND, mini = false, tooltip = "PC_REWIND_HINT", }, callback = cinema_clip_editor_cb_rewind, }, 
  2054. 	[BTN_FREE_PLAY_SLOW] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_PLAY_SLOW, mini = false, tooltip = "PC_PLAY_SLOW_HINT", }, callback = cinema_clip_editor_cb_play_slow, }, 
  2055. 	[BTN_FREE_PLAY] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_PLAY, mini = false, tooltip = "PC_PLAY_HINT", }, callback = cinema_clip_editor_cb_play, }, 
  2056. 	[BTN_FREE_PLAY_FAST] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_PLAY_FAST, mini = false, tooltip = "PC_PLAY_FAST_HINT", }, callback = cinema_clip_editor_cb_play_fast, }, 
  2057. 	[BTN_FREE_PAUSE] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_PAUSE, mini = false, tooltip = "PC_PAUSE_HINT", }, callback = cinema_clip_editor_cb_pause, }, 
  2058. 	[BTN_FREE_OPTIONS] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_OPTIONS, mini = false, tooltip = "PC_OPTIONS_HINT", }, callback = cinema_clip_editor_cb_options, }, 
  2059. 	[BTN_FREE_AV] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_AV_OPTIONS, mini = false, tooltip = "PC_AV_OPTIONS_HINT", }, callback = cinema_clip_editor_cb_av, }, 
  2060. 	[BTN_FREE_SAVE] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_SAVE, mini = false, tooltip = "PC_SAVE_HINT", }, callback = cinema_clip_editor_cb_save, }, 
  2061. 	[BTN_FREE_EXPORT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXPORT, mini = false, tooltip = "PC_EXPORT_HINT", }, callback = cinema_clip_editor_cb_export, }, 
  2062. 	[BTN_FREE_EXIT] = { button = nil, data = { type = PC_TYPE_ICON, icon = PC_ICON_EXIT, mini = false, tooltip = "PC_EXIT_HINT", }, callback = cinema_clip_editor_cb_exit, }, 
  2063. 	-- Bottom row 
  2064. 	[BTN_FREE_SHOW_KEYS] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_SHOW_KEYS", tooltip = "PC_SHOW_KEYS_HINT", }, callback = cinema_clip_editor_cb_show_keys, }, 
  2065. 	[BTN_FREE_HIDE_HUD] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_HIDE_HUD", tooltip = "PC_SHOW_HUD_HINT", }, callback = cinema_clip_editor_cb_hide_hud, }, 
  2066. 	[BTN_FREE_SHOW_HUD] = { button = nil, data = { type = PC_TYPE_NORMAL, label = "PC_SHOW_HUD", tooltip = "PC_SHOW_HUD_HINT", }, callback = cinema_clip_editor_cb_show_hud, }, 
  2067. } 
  2068.  
  2069. -- Reference to data for all buttons (used for mouse inputs) 
  2070. CCE_buttons = {} 
  2071.