MacroScript get_vector_tool_mcr category:"MOACH_GetVectorTool" buttonText:"Get Vector Tool"
(
rollout getVectorTool "Get Vector Tool" width:321 height:360
(
button btn3 ":: get it ::" pos:[8,8] width:305 height:45
global _mode = 1
dropdownlist mode_dd "Format" pos:[8, 55] width:305 items:#("C++ _V singles", "DXS Vector singles", \
"CFG (spaced) single entries", "CFG (commas) single entries", "C++ _V V3_ named defines *beware of spaces*",\
"C++ _V V3_TDIR_ defines :: targets delta-vector (normalized)")
on mode_dd selected i do
(
_mode = i
)
editText vector_out "" pos:[4,110] width:309 height:225 enabled:true bold:true readOnly:true
on btn3 pressed do
(
vector_out.text = ""
for i in selection do
(
case _mode of
(
----------------------------------------------------------------------------------------------------------------------------------- C++ style single _V (for orbiter)
1: vector_out.text += i.name + ">> \n\t" + ("_V("+(i.pivot.x as string)+", "+(i.pivot.z as string)+", "+((-i.pivot.y) as string)+")\n\n")
----------------------------------------------------------------------------------------------------------------------------------- DXS javascript style
2: vector_out.text += i.name + ">> \n\t" + ("new Vector("+(i.pivot.x as string)+", "+(i.pivot.z as string)+", "+((-i.pivot.y) as string)+");\n\n")
----------------------------------------------------------------------------------------------------------------------------------- CFG file entry (space separated)
3: vector_out.text += i.name + ">> \n\t" + ((i.pivot.x as string)+" "+(i.pivot.z as string)+" "+((-i.pivot.y) as string)+"\n\n")
----------------------------------------------------------------------------------------------------------------------------------- CFG (with commas)
4: vector_out.text += i.name + ">> \n\t" + ((i.pivot.x as string)+", "+(i.pivot.z as string)+", "+((-i.pivot.y) as string)+"\n\n")
----------------------------------------------------------------------------------------------------------------------------------- V3_ named defines
5: vector_out.text += "#define V3_"+i.name + " _V(" +((i.pivot.x as string)+", "+(i.pivot.z as string)+", "+((-i.pivot.y) as string)+")\n")
----------------------------------------------------------------------------------------------------------------------------------- V3_AX targets delta-dir defines
6: (
if (i.target != undefined) do (
axis = normalize (i.target.pivot - i.pivot)
vector_out.text += "#define V3_TDIR_"+i.name +"_V(" +((axis.x as string)+", "+(axis.z as string)+", "+((-axis.y) as string)+")\n")
)
)
)
)
)
button toCB ":: Copy-Paste Me! ::" pos:[8, 340] width:305 height:20
on toCB pressed do
(
setclipboardText vector_out.text
)
)
createDialog getVectorTool 325 365
)