[Closed] Add RMB – event Help ?
Hi,
I just want to open the modifier tab instantly
i want to pres hotkey to open the script and (simulate Right click to open modifier tab) right a way
[quote=]macroScript Expert
category:“Pixamoon”
toolTip:“Expert”
(
if ::_netForm != undefined do try(_netForm.close())catch()
local settingsINI = getdir(#userScripts)+”\em_modifier_ctrls_settings.ini”
local MRG1111 = (dotNetObject “padding” 1 1 1 1) , cursorPos
local ttText = ” Label Commands:
LMB – move form
MMB – select base object
RMB – open context menu
ContextMenu Commands:
LMB – select modifier
MMB – toggle enable/disable
RMB – delete modifier”
fn _netRect x y w h = (dotNetObject “System.Drawing.Rectangle” x y w h)
fn _netSize x y = (dotNetObject “System.Drawing.Size” x y)
fn _netColor r g b = ((dotNetClass “System.Drawing.Color”).FromArgb r g b)
fn _netBrush clr = (dotNetObject “System.Drawing.SolidBrush” clr)
fn _netPoint x y = (dotNetObject “System.Drawing.Point” x y)
fn _netFontB fName fSize = (dotNetObject “System.Drawing.Font” fName fSize ((dotNetClass “System.Drawing.FontStyle”).bold))
fn _netFont fName fSize = (dotNetObject “System.Drawing.Font” fName fSize)
fn defNWin =
(
nw = dotNetObject “NativeWindow”
nw.AssignHandle (DotNetObject “System.IntPtr” (Windows.GetMaxHWND())) ; nw
)
local nw = defNWin()
struct _netColorStruct
(
maxBC = (colorMan.getColor #background) * 255.0,
maxFC = (colorMan.getColor #Text) * 255.0,
C1a = _netColor maxBC.x maxBC.y maxBC.z,
C1b = _netColor (maxBC.x-10) (maxBC.y-10) (maxBC.z-10),
C1c = _netColor (maxBC.x-20) (maxBC.y-20) (maxBC.z-20),
C2 = _netColor maxFC.x maxFC.y maxFC.z,
C3 = _netColor 0 0 0,
C4 = _netColor 150 20 20
)
global _netColors = _netColorStruct()
fn _netToolTip dnTT =
(
dnTT.AutoPopDelay = 10000 ; dnTT.InitialDelay = 2000 ; dnTT.ReshowDelay = 2000
dnTT.BackColor = _netColors.C1c ; dnTT.OwnerDraw = on ; dnTT
)
_netForm = dotnetobject “Form”
_netForm.ShowInTaskbar = off
_netForm.StartPosition = _netForm.StartPosition.Manual
_netForm.ClientSize = _netSize 200 10 –sizzzzzzzzzzze
_netForm.FormBorderStyle = _netForm.FormBorderStyle.None
_netForm.AutoSizeMode = _netForm.AutoSizeMode.GrowAndShrink
_netForm.AutoSize = _netForm.TopMost = on ; _netForm.BackColor = _netColors.C3
_netForm.DesktopLocation = if not (doesFileExist settingsINI) then _netPoint 30 110 else
(
local x = (mouse.screenpos.x-100) as integer
local y = (mouse.screenpos.y-5) as integer –here fucking ya – mouse.screenpos.x
_netPoint X Y
)
local _netLabel = dotnetobject “Label”
_netLabel.Bounds = _netRect 1 1 191 18 ; _netLabel.Margin = MRG1111
_netLabel.BackColor = _netColors.C1b ; _netLabel.ForeColor = _netColors.C3
_netLabel.TextAlign = _netLabel.TextAlign.MiddleCenter
_netLabel.Font = _netFontB “Verdana” 6.5
_netLabel.Text = “Select Object”
local _netButton = dotnetobject “Button”
_netButton.Bounds = _netRect 193 1 6 18
_netButton.FlatStyle = _netButton.FlatStyle.Flat
_netButton.FlatAppearance.BorderSize = 0 ; _netButton.Margin = MRG1111
_netButton.BackColor = _netButton.FlatAppearance.BorderColor = _netColors.C4
local _netTip = dotnetobject “ToolTip” ; (_netToolTip _netTip).SetToolTip _netButton ttText
local _netTimer = dotNetObject “Timer” ; _netTimer.Interval = 100 ; _netTimer.Enabled = false
local _netCM = dotnetobject “ContextMenuStrip”
_netCM.ShowImageMargin = off
_netCM.Autosize = _netCM.ShowCheckMargin = on
_netCM.RenderMode = _netCM.RenderMode.Professional
_netCM.BackColor = _netColors.C1b
fn add_MenuItem mody =
(
mi = dotnetobject “ToolStripMenuItem” mody.name
mi.tag = dotnetmxsvalue mody
mi.checked = mody.enabled
dotnet.addEventHandler mi “MouseUp”
(
fn mi_Click s arg =
(
case arg.Button of
(
(arg.Button.Left):
(
if modPanel.getCurrentObject() == undefined do max modify mode
modPanel.setCurrentObject s.tag.value
)
(arg.Button.Middle): (s.Checked = (s.tag.value).enabled = not s.Checked ; max create mode ; max modify mode)
(arg.Button.Right): (undo “Del_Modifier” on deletemodifier ((refs.dependentnodes s.tag.value)[1]) s.tag.value)
)
)
) ; mi
)
fn _netLabel_MouseDown s arg = (s.BackColor = _netColors.C1c ; cursorPos = [(mouse.screenpos.x – _netForm.DesktopLocation.x), (mouse.screenpos.y – _netForm.DesktopLocation.y)])
fn _netLabel_MouseMove s arg =
(
if arg.Button == arg.Button.Left and cursorPos != undefined do
(
_netForm.DesktopLocation = _netPoint (mouse.screenpos.x – cursorPos.x) (mouse.screenpos.y – cursorPos.y)
)
)
fn _netLabel_MouseUp s arg =
(
s.BackColor = _netColors.C1a
if isValidNode (obj = getNodeByName (s.text)) do
(
case arg.Button of
(
(arg.Button.Right): cursorPos = undefined
(arg.Button.Middle):
(
if modPanel.getCurrentObject() == undefined do max modify mode
modPanel.setCurrentObject obj.baseobject
)
(arg.Button.Left):
(
s.ContextMenuStrip.Items.Clear()
if (cnt = obj.modifiers.count) == 0 then (s.ContextMenuStrip.items.add (dotnetobject “ToolStripMenuItem” “No Modifiers”)) else
(
for i in 1 to cnt do s.ContextMenuStrip.items.add (add_MenuItem obj.modifiers[i])
)
s.ContextMenuStrip.Show s (_netPoint arg.x arg.y)
)
)
)
format “obj = %
” (isValidNode (obj = getNodeByName (s.text)))
)
fn _netTip_draw s arg =
(
local _netTTB = _netBrush _netColors.C2, _netST = dotnetobject “System.Drawing.StringFormat”, _netTTF = _netFont “Tahoma” 8.5
local _netRectF = dotnetobject “System.Drawing.RectangleF” arg.Bounds.x arg.Bounds.y (arg.Bounds.width) (arg.Bounds.height)
arg.DrawBackground() ; arg.DrawBorder() ; _netST.LineAlignment = _netST.LineAlignment.Center
arg.Graphics.DrawString arg.ToolTipText _netTTF _netTTB _netRectF _netST
)
fn _netButton_close =
(
SetIniSetting settingsINI “FormLocation” “PosX” (_netForm.DesktopLocation.x as string)
SetIniSetting settingsINI “FormLocation” “PosY” (_netForm.DesktopLocation.y as string)
_netTimer.Stop() ; dotnet.removeAllEventHandlers _netTimer ; _netTimer.Dispose()
try(_netForm.close())catch() ; _netForm = undefined ; clearundobuffer() ; clearListener()
)
fn checkSelection =
(
if isKindOf _netForm dotNetObject and isCreatingObject() == false do
(
if selection.count == 1 then
(
_netForm.Controls.item[0].ForeColor = _netColors.C2
_netForm.Controls.item[0].Text = selection[1].name
)
else
(
_netForm.Controls.item[0].ForeColor = _netColors.C3
_netForm.Controls.item[0].Text = “Select Object”
)
)
)
dotnet.addeventhandler _netTip “Draw” _netTip_draw
dotNet.addEventHandler _netLabel “MouseDown” _netLabel_MouseDown
dotNet.addEventHandler _netLabel “MouseMove” _netLabel_MouseMove
dotNet.addEventHandler _netLabel “MouseUp” _netLabel_MouseUp
dotNet.addEventHandler _netLabel “MouseHover” (fn _netLabel_MouseHover s arg = (s.BackColor = _netColors.C1a))
dotNet.addEventHandler _netLabel “MouseLeave” (fn _netLabel_MouseLeave s arg = (s.BackColor = _netColors.C1b))
dotnet.addEventHandler _netCM “Closed” (fn _netCM_close s e = s.items.Clear())
dotnet.addEventHandler _netButton “MouseUp” _netButton_close
dotNet.addEventHandler _netTimer “Tick” (fn _netTimerTick = checkSelection())
_netLabel.ContextMenuStrip = _netCM
_netForm.Controls.addrange #(_netLabel,_netButton)
dotNet.setLifetimeControl _netForm #dotnet
_netForm.Show (nw) ; nw.ReleaseHandle() ; _netTimer.Start()
ok
)
i reach to point that i know which part control tab appearing :
quote=:
(
s.ContextMenuStrip.Items.Clear()
if (cnt = obj.modifiers.count) == 0 then (s.ContextMenuStrip.items.add (dotnetobject “ToolStripMenuItem” “No Modifiers”)) else
(
for i in 1 to cnt do s.ContextMenuStrip.items.add (add_MenuItem obj.modifiers[i])
)
s.ContextMenuStrip.Show s (_netPoint arg.x arg.y)
-i tried to simulate right click button (but i’m don’t have any programming skills ,i just copy-paste from script to another )
-i think if we can force the tab to show by button instead of mouse click !?
- I’m not the owner of the script
- i just edit and add to Category so i can assign hotkey
- and add script to make it show in the center of the mouse
the orginal script :
http://www.scriptspot.com/3ds-max/scripts/expertmode-modifiers-control
Thanks in advance
that’s how you rightclick a control
windows.sendMessage (::_netForm.controls.item 0).Handle 0x204 0x2 0xF0038
windows.sendMessage (::_netForm.controls.item 0).Handle 0x205 0x0 0xF0038
ok, perfect
update: it worked in the same script ,i put it within the lines it preform loop
i tried to put stoploop to click just once but dosen’t work
but it doesn’t work until i put it in a single script alone
so i need a key to preform the plugin
then a key to preform the mouse script
and thanks alot