Notifications
Clear all

[Closed] switch to Havok3 by script?

Is it possible to switch to Havok3 with a script line?
thank you

5 Replies
1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

it’s possible…


fn setHavok id:1 = 
(
 UtilityPanel.OpenUtility reactor
 
 utip = for w in (windows.getChildrenHWND #max) where w[5] == "Command Panel" do exit with w[1]
 if utip != OK do
 (
  cbox = for w in (windows.getChildrenHWND utip) where w[4] == "ComboBox" and matchpattern w[5] pattern:"Havok*" do exit with w[1]
  if cbox != OK do
  (
   CB_GETCURSEL = 0x0147
   CB_SETCURSEL = 0x014E
   WM_COMMAND = 0x0111
   CBN_SELCHANGE = 0x0001
   
   if (windows.sendMessage cbox CB_GETCURSEL 0 0) != id do 
   (
	windows.sendMessage cbox CB_SETCURSEL id 0
	
	wparent = UIAccessor.GetParentWindow cbox
	cbox_id = UIAccessor.getWindowResourceID cbox --0x04ac
	windows.sendMessage wparent WM_COMMAND (bit.or (CBN_SELCHANGE*0x010000) cbox_id) cbox
	id
   )
  )
 )
)

setHavok id:0 – Havok 1
setHavok id:1 – Havok 3

it looks a little crazy but it should work…

You would probably have to use the UIAccessor or the .Net Windows Structure as there is no direct access.

-Eric

thank you! that works!

It works fine but I have to close the popup Analyse window. I don’t really understand how the UI AAccessor works. I just want to uncheck the “Analyse on Solver Switch button” in the Reactor Utils or to close the window when popup.

1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

fn havokAnalyzeSwitchToggle = 
(
 UtilityPanel.OpenUtility reactor
 utip = for w in (windows.getChildrenHWND #max) where w[5] == "Command Panel" do exit with w[1]
  
 if utip != OK do
 (
  cbox = for w in (windows.getChildrenHWND utip) where matchpattern w[5] pattern:"Analyze On Solver Switch" do exit with w[1]
  if cbox != OK do
  (
   -- WM_LBUTTON_DOWN  = 0x0201
   -- WM_LBUTTON_UP  = 0x0202  
   windows.sendMessage cbox 0x0201 0 0
   windows.sendMessage cbox 0x0202 0 0
  )
 ) 
)
 
its toggles the check box state, but i don't know how to get state of the checkbox