[Closed] Selection Region
are you asking about selection type (#window|#crossing|#leftToRight|#rightToLeft)?
it sounds silly but there is no way to get selection type (via sdk as well) without some ui reading hack.
current crossing/window state can be determined at least (MXS)
GetCrossing()
Don’t know about a way to change it via MXS without hacks
though it’s exposed in the SDK
http://docs.autodesk.com/3DSMAX/16/ENU/3ds-Max-SDK-Programmer-Guide/index.html?url=cpp_ref/group___auto___crossing___selection___mode.html,topicNumber=cpp_ref_group___auto___crossing___selection___mode_html8e4d3166-fe6d-48e8-8ab8-d3eda19c4e5d
My question was about “Selection Region types” (Rectangular, Circular, Fence,…).
:argh: , Lets do it with hack. I guess its handler is 132604P, But i don’t know how we can send a message to get its state.
fn PrintData Hwnd =
(
format “Dialog Window Handle: %
” Hwnd
format “Dialog Name: %
” (UIAccessor.GetWindowText Hwnd)
format “Window Class Name: %
” (UIAccessor.GetWindowClassName Hwnd)
format “Window Resource ID: %
” (UIAccessor.GetWindowResourceID Hwnd)
format “Is Window: %
” (UIAccessor.isWindow Hwnd)
format “Window DLL Filename: %
” (UIAccessor.GetWindowDllFileName Hwnd)
format “Window DLL Description: %
” (UIAccessor.GetWindowDllDescription Hwnd)
format “Window Parent: %
” (UIAccessor.GetWindowText (UIAccessor.GetParentWindow Hwnd))
format “=====================
“
)clearlistener()
for d in (UIAccessor.GetChildWindows (windows.getMAXHWND())) where (UIAccessor.GetWindowText d) == “Main Toolbar” do
(
for dd in (UIAccessor.GetChildWindows d) where dd == 132604P do
(
PrintData dd
–UIAccessor.closedialog dd
)
)
For the selection mode ( fence, box , etc ) there is
max cycle select
and you can set to specific modes by the corresponding user actions
actionMan.executeAction 0 "59232" -- Selection: Rectangular Selection Region
actionMan.executeAction 0 "59233" -- Selection: Circular Selection Region
actionMan.executeAction 0 "59234" -- Selection: Fence Selection Region
actionMan.executeAction 0 "59235" -- Selection: Lasso Selection Region
actionMan.executeAction 0 "59236" -- Selection: Paint Selection Region
So depending on your needs this might help you achieving the things you want to do
there is no probably state for this button… the state is something internal. but as you know id (hwnd) of control you probably can get an icon id. the id has to correspond to selection mode.
it’s a theory only. that’s what i would try
it seems icons wouldn’t change, All icons are arranged in one image and this image moves depend on button’s mode.(I guess)
do you have spy++? try…
if spy can see any difference (resource id for example) theoretically we can see it too
btw. why do you need to know the mode?
Actually I don’t have any hack experiences, but I will try the spy++. I just recreated some tools and buttons (including this option) from main toolbar, and i need to update them both (old and new toolbars).
if you know the HWND you should be able to do the following in the SDK
ICustButton* selectmodeflyoff = GetICustButton(theHWND);
int mode = selectmodeflyoff->GetCurFlyOff ();
ReleaseICustButton(selectmodeflyoff);
this works
def_visible_primitive(getFlyOffState, "getFlyOffState");
Value* getFlyOffState_cf(Value **arg_list, int count)
{
check_arg_count(getFlyOffState, 1, count);
ICustButton* flyoff = GetICustButton((HWND)arg_list[0]->to_int());
if(flyoff)
{
int mode = flyoff->GetCurFlyOff ();
ReleaseICustButton(flyoff);
return Integer::intern(mode);
}
return &undefined;
}
you can then call from mxs with the lovely and elegant
getFlyOffState ((windows.getChildrenHWND (windows.getChildHWND #max "Main Toolbar")[1] )[10])[1]