Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

max script - select bitmap in displace modifier

4 REPLIES 4
Reply
Message 1 of 5
brunomartelli
1097 Views, 4 Replies

max script - select bitmap in displace modifier

Hi

 

- how do i make a script to let me

 

1. pick an object

2. set its displace modifiers bitmap letting me choose the bitmap

3. apply a ProOptimser?

4. repeat for 3 objects

5. Export, letting me choose what name?

 

- the macrorecorder won't register button click on the Displace /Bitmap Button

 

regards

Bruno

 

4 REPLIES 4
Message 2 of 5
Swordslayer
in reply to: brunomartelli

Quite a few things at once, I will give you some pointers (links to maxscript reference, be sure to click and read through all of them):

 

1. have a look at PickObject function

2. obj.displace.bitmap = getOpenFilename ...

3. addModifier obj (ProOptimizer())

4. do the whole process in for or while loop

5. exportFile function together with the aforementioned getOpenFilename function

 

 

Message 3 of 5

I think I'd avoid trying to use the Modify panel for this. Create a small Dialog, with a PickButton (to pick the object), a MapButton to open the Material/Map browser (which will let you pick a bitmap (file) in the usual way, and maybe a normal button to apply the chosen bitmap to the Displace Modifier's Bitmap property and add the ProOptimise. That's for 1 object - if you want to do it for 3 objects then either select all three at the same time, or call the dialog 3 times. Remember the 3 objects so you can export them at the end.

[Edit]Beaten to it again, with a better suggestion 😉[/Edit]

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 4 of 5
brunomartelli
in reply to: Swordslayer

thanks, but

 

-  i dont understand and 

 

$LOD001.obj.displace.bitmap = getOpenFilename

 doesnt work or this either

 

obj.displace.bitmap = getOpenFilename

 

 

 

Message 5 of 5
Swordslayer
in reply to: brunomartelli

No, I'm not giving you anything finished, just some pointers - that's why there's ellipsis at the end of the line and that's why it's a link so that you click on it and see the syntax, so for example one way would be:

 

objectsPicked = 0

while objectsPicked < 3 do
(
	messageBox "Pick Object"
	local obj = pickObject()
	if obj != undefined do
	(
		objectsPicked += 1
		obj.displace.bitmap = getOpenFileName types:"JPEG (*.jpg)|*.jpg|Portable Network Graphics (*.png)|*.png|All files (*.*)|*.*|"
		addModifier obj (ProOptimizer())
	)
)
exportFilename = getOpenFileName types:"Wavefront Object (*.obj)|*.obj"
if exportFilename != undefined do exportFile exportFilename #noPrompt selectedOnly:true

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report