I came up with a tool that saves the amount of frames of the scene by clicking on a button and using the right mouse button loads the amount of saved frames.
I would like to use the tool in a toolbar, seeing the timerange button ready to be clicked and not first click a button and that button opens the tool. 🤔
(
global rol_test
local orig_anim_range
try(destroyDialog rol_test)catch()
rollout rol_test ""
(
button btn_pressMe "TimeRange"
fn testA = orig_anim_range=animationRange
fn testB = animationRange=orig_anim_range
on btn_pressMe pressed do
(
print "Button pressed"
testA()
)
on btn_pressMe rightClick do
(
print "Button pressed"
testB()
)
)
createdialog rol_test
)
Solved! Go to Solution.
Solved by denisT.MaxDoctor. Go to Solution.
macroScript HoldAnimationRange
category:"Animation"
buttontext:"ANIMRANGE"
toolTip:"Hold Animation Range\n +SHIFT\t\t- Fetch"
(
local animrange = undefined
on execute do
(
if keyboard.shiftpressed then
try (animationRange = animrange) catch()
else
animrange = animationRange
)
)
Here is a macro script, and this is how I would do it if I wanted to keep all simple.
Instead of defining an additional rollout (popup dialog), I would use the same button on the toolbar to hold the state of the animation range and retrieve the previously held one by pressing the same button with the SHIFT key.
The CTRL and ALT modifier keys are used by the MAX dialog protocol, as well as mouse right-click, and cannot simply be used with a custom user interface. Therefore, only the SHIFT key is available as an option.
We can also use the "button ON" to hold the range and the "button OFF" to bring it back, +SHIFT to override the range. But, in my opinion, this functionality will be less convenient.
I totally agree, as it is, it is perfect for my needs.
as it is not a button maybe it is not possible to change the internal text when it was first used?
Hello,
After executing this, on the button, we can able to right click, so that some menu will be displayed and functionalities will be executed according to the selection.
Upto Max 2015, we superclass the right click procedure to avoid showing the menu, that works fine. When we shifted to Max 2018, (Qt started), the same right click procedure is not working. Means, the menu is showing on right click.
Any idea how to disable right click - after Max 2018 version?
Regards,
Gopinath.
@tagopinath wrote:Upto Max 2015, we superclass the right click procedure to avoid showing the menu, that works fine.
could you show how you did it in versions "up to max 2015"?
Here is how i am doing
// this is in begineditparams function
::EnumChildWindows(GetCOREInterface()->GetMAXHWnd(), EnumChildModel, 0);
// using RightWnd - finding the CustButton
for(int i=0;i<NumOfToolBars;i++)
{
EnumChildWindows(RightWnd[i],EnumChildModel1,0);
}
///////////////////
// definition for EnumChild functions
//In EnumChildModel - finding all CustToolbar
BOOL CALLBACK EnumChildModel(HWND hWnd, LPARAM lParam)
{
TCHAR stmain1[100], stmain2[100];
static int iCount=0;
GetClassName(hWnd, stmain1, 100);
if(_tcscmp(stmain1, L"CustToolbar")==0)
{
RightWnd[iCount]=hWnd;
iCount++;
}
return true;
}
BOOL CALLBACK EnumChildModel1(HWND hWnd, LPARAM lParam)
{
TCHAR st1[100];
GetClassName(hWnd, st1, 100);
if(_tcscmp(st1, L"CustButton")==0)
{
rightproc = (WNDPROC) SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR) RightClickProc);
}
return true;
}
// superclassing right click procedure
LRESULT APIENTRY RightClickProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
if(uMsg == WM_RBUTTONDOWN)
{
return TRUE;
}
return CallWindowProc(rightproc, hwnd, uMsg,
wParam, lParam);
}
Regards,
Gopinath.
Ok. I see now. I was confused by your sentence "we superclass the right click procedure".
Can't find what you're looking for? Ask the community or share your knowledge.