Notifications
Clear all

[Closed] Hair Fur stat files

Hello,
how can i access to “stat files” path with maxscript to Hair and Fur modifier?
Thanks for any help

5 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

modify_task_window = for c in windows.getchildrenHWND #max where c[4] == "ModifyTask" do exit with c[1]
radio_bt_precomputed = windows.getchildHWND modify_task_window "Precomputed"
text_box_stat_name = uiaccessor.getnextwindow radio_bt_precomputed[1]
stat_file_name = uiaccessor.getwindowtext text_box_stat_name

I found some scripts from ZeBoxx2 (thanx a lot man) that can access all what i want.
I did change the path of the “Stat Files” but when i Run simulation or click on the another object the path is gone. Pls help


fn sethair o val = (     	
        WM_COMMAND = 0x0111     
	EN_CHANGE = 0x0300     	
        EN_KILLFOCUS = 0x0200     	
        WM_KILLFOCUS = 0x0008      
    	mainHWND = windows.getDesktopHWND()      
  	setCommandPanelTaskMode #modify 	  
	modPanel.setCurrentObject o.modifiers[#Hair_and_Fur]   
     	children = windows.getChildrenHWND mainHWND     
	local segsIndex 	    
  	for i = 1 to children.count do ( if (children[i][5] == "Precomputed") then ( segsIndex = i ) )    	

        spinnerEditHWND = children[segsIndex+1][1]   
   	spinnerEditParentHWND = UIAccessor.getParentWindow spinnerEditHWND 
    	spinnerEditID = UIAccessor.getWindowResourceID spinnerEditHWND  
        UIAccessor.setWindowText spinnerEditHWND (val as string)    
 	windows.sendMessage spinnerEditParentHWND WM_COMMAND ((bit.shift EN_CHANGE 16) + spinnerEditID) spinnerEditHWND     
	windows.sendMessage spinnerEditParentHWND WM_COMMAND ((bit.shift EN_KILLFOCUS 16) + spinnerEditID) spinnerEditHWND  
   	windows.sendMessage spinnerEditHWND WM_KILLFOCUS 0 0   
)  
Box isSelected:on   
modPanel.addModToSelection (HairMod ()) ui:on   
sethair $ "C:\	est.stat"  

denisT: thanks for reply
your code is basicly the same function right? If i want to change stat files path to “c:\ est.stat”

I changed the script like this


modify_task_window = for c in windows.getchildrenHWND #max where c[4] == "ModifyTask" do exit with c[1]
radio_bt_precomputed = windows.getchildHWND modify_task_window "Precomputed"  
text_box_stat_name = uiaccessor.getnextwindow radio_bt_precomputed[1]  
stat_file_name = uiaccessor.getwindowtext text_box_stat_name  
uiaccessor.setwindowtext text_box_stat_name "c:\	est.stat"  

Problem is the same (when i Run simulation or click on the another object the new path “c:\ est.stat” is gone)
Maybe it will be possible change it with the “…” button. I tried but when the next window popup my script freeze until i click “storno” or “save” button. Thanks

2 Replies
(@denist)
Joined: 11 months ago

Posts: 0

only way that i see is to use “…” button. you can take a look at
http://forums.cgsociety.org/showpost.php?p=6590713&postcount=1 .
i show there how to catch file-save dialog and set a filename. all that you need extra is to press “Save” button. Use UIAccessor for it.

(@grakus)
Joined: 11 months ago

Posts: 0

Thank you :bowdown: :bowdown: :bowdown:
A few days ago i didn’t have any idea about this “hacking” method. Finally I have what I needed. PROBLEM SOLVED
Here’s the rough script if someone has a similar problem


fn stat_files_button obj = 
(
mainHWND = windows.getDesktopHWND()
setCommandPanelTaskMode #modify
modPanel.setCurrentObject obj.modifiers[#Hair_and_Fur]
children = windows.getChildrenHWND mainHWND
local hwndIndex
for i = 1 to children.count do ( if (children[i][5] == "...") then ( hwndIndex = UIAccessor.getParentWindow children[i][1] ) )
UIAccessor.PressButtonByName hwndIndex "..."
)
 
fn saveAs_notification = 
(
local hwnd, name, owner
 
name = if UIAccessor.isWindow (hwnd = DialogMonitorOPS.GetWindowHandle()) do UIAccessor.GetWindowText hwnd
if (name == "Save As") do
 (
 owner = UIAccessor.GetParentWindow hwnd
 if getfilenamefile (UIAccessor.GetWindowDllFileName owner) == "3dsmax" do 
  (
  input = UIAccessor.GetNextWindow (windows.getChildHWND hwnd "File &name:")[1]
  UIAccessor.SetWindowText input objpath
  UIAccessor.PressButtonByName hwnd "&Save"
  )
 )
true
)
 
DialogMonitorOPS.RegisterNotification saveAs_notification id:#saveAsMonitor
DialogMonitorOPS.Enabled = on
DialogMonitorOPS.ShowNotification()
global objpath="c:\	est.stat"
stat_files_button $