Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there any way to make the trackview transparent like when we try to dock it?
animator
Solved! Go to Solution.
Is there any way to make the trackview transparent like when we try to dock it?
Solved! Go to Solution.
in the lower version of max, I can use:
HiddenDOSCommand ("python G:\\trackviewAlpha.py") donotwait:true startpath:"c:\\"
to run a py:
import win32gui
import win32con
import winxpgui
import win32api
import subprocess
import time
hwnd = win32gui.FindWindow(None, "cometTrackview") ## name
win32gui.SetWindowLong (hwnd, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (hwnd, win32con.GWL_EXSTYLE ) | win32con.WS_EX_LAYERED )
winxpgui.SetLayeredWindowAttributes(hwnd, win32api.RGB(0,0,0), 180, win32con.LWA_ALPHA)
to get the transparent track view. But in 2018 there seems to have been a callback. will make the track view not transparent again..ORZ
if I write another callback against the system callback seems too silly...
and it's very slow (=′ー`)
fn CreateUser32AssistAssembly =
(
source = "using System;\n"
source += "using System.Runtime.InteropServices;\n"
source += "class Wind32Assists\n"
source += "{\n"
source += " [DllImport(\"user32.dll\", EntryPoint=\"UpdateWindow\")]\n"
source += " public static extern bool UpdateWindow(IntPtr hWnd);\n"
source += " [DllImport(\"user32.dll\", EntryPoint=\"GetWindowLong\")]\n"
source += " public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 index);\n"
source += " [DllImport(\"user32.dll\", EntryPoint=\"SetWindowLong\")]\n"
source += " public static extern Int32 SetWindowLong(IntPtr hWnd, Int32 index, Int32 newVal);\n"
source += " [DllImport(\"user32.dll\")]\n"
source += " public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);\n"
source += "}\n"
csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
compilerParams.GenerateInMemory = on
compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)
assembly = compilerResults.CompiledAssembly
assembly.CreateInstance "Wind32Assists"
)
global Wind32Ass = CreateUser32AssistAssembly()
fn setWindowSemitransparent hwnd alpha =
(
WS_EX_LAYERED = 0x00080000
GWL_EXSTYLE = (-20)
LWA_ALPHA = 0x00000002
style = Wind32Ass.GetWindowLong hwnd GWL_EXSTYLE
Wind32Ass.SetWindowLong hwnd GWL_EXSTYLE (bit.or style WS_EX_LAYERED)
Wind32Ass.SetLayeredWindowAttributes hwnd 0 (alpha*255) LWA_ALPHA
)
fn setWindowOpaque hwnd =
(
WS_EX_LAYERED = 0x00080000
GWL_EXSTYLE = (-20)
LWA_ALPHA = 0x00000002
Wind32Ass.SetLayeredWindowAttributes hwnd 0 255 LWA_ALPHA
style = Wind32Ass.GetWindowLong hwnd GWL_EXSTYLE
Wind32Ass.SetWindowLong hwnd GWL_EXSTYLE (bit.and style (bit.not WS_EX_LAYERED))
Wind32Ass.UpdateWindow hwnd
)
fn findTrackViewHwnd pattern:"*" =
(
hwnd = for k=1 to trackView.numTrackViews() do
(
name = trackView.getTrackViewName k
if matchpattern name pattern:pattern do
(
hwnd = (trackviews.getTrackView k).ui.hwnd
exit with hwnd
)
)
if hwnd == OK then 0 else hwnd
)
------- USING ---------------->
my_trackview_name = "Track View*" -- name or wildcard
hwnd = findTrackViewHwnd pattern:my_trackview_name
setWindowSemitransparent hwnd 0.5 -- set half-transparent (aplha == 0.5)
setWindowOpaque hwnd -- set opaque (aplha == 1)
wow~nice.it's much faster when work with the callback.TKS
-- 实时透明化
fn trackviewAlpha_yun =
( setWindowSemitransparent hwnd 0.5 )
try(unRegisterRedrawViewsCallback trackviewAlpha_yun)catch()
registerRedrawViewsCallback trackviewAlpha_yun