Naming a material or map

Hi all

Really simple question, and no doubt my first of many for my new script idea!

I've written script to put a VrayHDRI map in to slots 1 & 2 of the material editor but I can't figure out how to name these maps.

How do I script that?

Cheers

Script_Butler.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Script_Butler's picture

Thanks

Hi Anubis.

thanks for the link, and the script.

It's a similar thing to what i wanted. It was just the piece of script that copies an image string in to a map slot somewhere.

I have creted the rest of my script, wiring parameters and stuff together.

I will see if i can pich the part i need from your and implement it in to mine.

I'll let you know hw i get on. I would definitely prefer just tips and help. I never want my ideas to be written fully for me!

Bookmarked.

Cheers.

Script_Butler

Script_Butler's picture

I just can't do it!

How can i add in a line that copies image1.filename and image2.filename to the texmap: in a HDRI map in the material editor?

I've searched and just can 't figure it out! It's so annoying!

Cheers.

Script_Butler

Anubis's picture

VRay Reference

Ok, I find something useful for you, just bookmark this page:
http://vraydoc.narod.ru/vray150sp1/objects_maxscript.htm

Here is the VRayHDRI map properties:

.HDRIMapName (Spin) : filename
.multiplier (Spin) : float
.renderMultiplier (Spin) : float
.mapType (Spin) : integer
.horizontalRotation (Spin) : angle
.verticalRotation (Spin) : angle
.horizontalFlip (Spin) : boolean
.verticalFlip (Spin) : boolean
.mapChannel (Spin) : integer
.gamma (Spin) : float

So, obviously HDRIMapName is what you look for.

Well, if I get the whole task, then this may help:

rollout roVRTool "Your Tool Name"
(
	local image1, image2
 
	button get_image1 "Pick HDRI File 1"
	button get_image2 "Pick HDRI File 2"
	button btn_Setup  "Setup"
 
	on get_image1 pressed do
	(image1 = selectBitmap caption:"Get Image File")
 
	on get_image2 pressed do
	(image2 = selectBitmap caption:"Get Image File")
 
	on btn_Setup pressed do
	(
		if image1 == undefined or \
		image2 == undefined then
			messageBox "You need 2 images!"
		else
		(
			map1 = VRayHDRI name:"HDRI GI" \
			HDRIMapName:(image1.fileName)
 
			map2 = VRayHDRI name:"HDRI Reflection" \
			HDRIMapName:(image2.fileName)
 
			vrl1 = VRayLight name:"Dome GI" \
			type:1 size0:150 size1:100 \
			pos:[-10,0,0] texmap:map1
 
			vrl2 = VRayLight name:"Dome Reflection" \
			type:1 size0:150 size1:100 \
			pos:[10,0,0] texmap:map2
		)
	)
)
createDialog roVRTool

But after all, I can just encourage you to search more ;-)

my recent MAXScripts RSS (archive here)

Script_Butler's picture

I'm so certain i tried that and it didn't work.

I'll try this later again. I probably had a small typo or something.

Cheers.

Cheers.

Script_Butler

Script_Butler's picture

Next question!

In my script i have a button to get an image file from a local drive. Once this file is selected it pastes the path in to an edittext box.

button get_image "Pick HDRI File" width:140
edittext bmp_name "File" text:"" 

Then i have the following code.

on get_image pressed do
(
pick_image = selectBitmap caption:"Get Image File"
if pick_image != undefined then bmp_name.text = pick_image.filename

I then have a button that is pressed that creates two HDRI maps and I want these HDRI maps to load in the image that the user has selected in the above coding.

How can i get this path string to appear in a HDRI map that is created through this script?

I hope that makes sense.

Cheers.

Script_Butler

Script_Butler's picture

Perfect

Thanks again Anubis.

I tried all manner of things by looking at other scripts i have but just couldn't get it!

I'm sure i'll be posting more questions about this script soon, it's going to get complicated.

Cheers.

Cheers.

Script_Butler

Anubis's picture

here is...

if your map is already in the ME slot and want to rename it:
meditMaterials[1].name = "New Name"

you can name your materials and/or maps in the creation process as well, for example, next code will create standard material with name Foo and will add it to the second ME slot:
meditMaterials[2] = standard name:"Foo"

my recent MAXScripts RSS (archive here)

Script_Butler's picture

Further to this

Hi Anubis.

Further to this I've changed my script a bit!

I've got a button that when you click it, it enables the user to select an image file on their computer. The path string is then pasted in to a edittext underneath.

How can i get this path to be put in to the .texmap of a Vray dome light?

I have a create button with the intention of it creating a VRayDomeLight with this texture added in to it automatically.

I hope that makes sense.

Cheers.

Script_Butler

Anubis's picture

Hi again

Well, as i said, i not work with VRay.
Check this tool - VrayHDRITool
(or wait for some vr-user reply)

my recent MAXScripts RSS (archive here)

Anubis's picture

i not use vray

so cannot help with anything concrete.
you s'd find the name of the property of your vr-map.
for example, create your map in 1st ME slot and print it properties to the Listener with show() function:
show meditMaterials[1]
it will show their names and their type/value.
keep in mind that there may have and nested values, which should research too.

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.