PDA

View Full Version : Help me Please !!!


jimrim
07-06-2005, 07:08 PM
sorry,my languge is not good but i will try to explain

1.If want use Material Editor must use 'max mtledit'
then if i want to close Material Editor , how to ??

2.About show picture sysInfo.currentdir+ "\image\aaa.gif"
sysInfo.currentdir is current directory
Run frist time it ok Picture show but if use selectBitmap anothor part
If we restart script, picture not show because path is change
sysInfo.currentdir ---> C:\Documents and Settings\A\My Documents\My Pictures\
How can fix it ?
3.
on makeobj pressed do (
a += 1
NameBuild = "Building0" + (a) as string
NameCamera = "Camera0" + (a) as string

max create mode
Building = Box lengthsegs:1 widthsegs:1 heightsegs:1 length:LengthBuild.value width:WidthBuild.value height:HeightBuild mapCoords:on pos:[Xbuild,Ybuild,0] isSelected:on name:NameBuild
.......
max mtledit
meditMaterials[a].diffuseMapEnable = on
meditMaterials[a].diffuseMap = Camera_Map_Per_Pixel ()
meditMaterials[a].diffuseMap.camera = Camera

meditMaterials[a].diffuseMap.texture = Bitmaptexture fileName:PathPicture.text
meditMaterials[a].diffuseMap.texture.alphaSource = 2
Building.material = meditMaterials[a] --> Can use
)

--but I write anothor
on Composit pressed do
(
aa = a-1

max mtledit
meditMaterials[10].diffuseMap = undefined
meditMaterials[10].diffuseMapEnable = on
meditMaterials[10].diffuseMap = CompositeTexturemap ()
meditMaterials[10].diffuseMap.mapList.count = aa

for b=0 to aa do
(
b += 1
(
meditMaterials[10].diffuseMap.mapEnabled[b] = on
meditMaterials[10].diffuseMap.mapList[b] = Camera_Map_Per_Pixel ()
meditMaterials[10].diffuseMap.mapList[b].camera = meditMaterials[b].diffuseMap.camera


meditMaterials[10].diffuseMap.mapList[b].texture = meditMaterials[b].diffuseMap.texture
meditMaterials[10].diffuseMap.mapList[b].texture.alphaSource = 2
)


Building.material = meditMaterials[10]) --> It's Error b'coz Building undefined but If open MaxScript Listener , print 'Building' and enter, Restart Script , error dispear and building can defined --> What's wrong, How can fix it?
)


Thank you very much

mobeen
07-07-2005, 06:31 PM
Hello there,
I will try to give answers to your questions to the best of my abilities.

1) Closing the mtledit dialog -> well i was unable to find a function in maxscript to do so if you reinvoke the same command the last dialog is automatically closed while the new pops up.

2) sysInfo.currentDir returns the current directory where you have placed your script. on startup it defaults to the max root. From what i have comprehended, i think you are trying to access images stored in the images folder relative to the scripts storage location. It should work ok (it did for me) check your code or post it here we will have a look at it.

3) I think you are making one big mistake here. You have declared a local variable by the name a in you handler (on makeobj pressed do () )This local variable is accessible only within its scope which remains till the handlers closing parenthesis is encountered. If you try to use it anywhere else max will create a local variable of the same name initialised with undefined. This is what is happening in the handler (on Composit pressed do). You have created a local variable (aa) and have initialised it to another local variable (a) which is undefined ???

I think this is what is responsible for all the trouble see if this sorts out your problem.
Thanx
Mobeen

jimrim
07-07-2005, 07:08 PM
1. I add 'max mtledit' again to last dialog program , Material Editor not close. ???

2. In fact, user want to add image from other location, may be not from same location of script.

3. I define a is global already, but I don't understand why Building not defined but if I open MaxScript Listener , print 'Building' and enter, Restart Script , error dispear and building can defined.

http://grad.fibo.kmutt.ac.th/temp/CameraMap.rar --> This is my script, help d/l and check this.

Bao2
07-07-2005, 08:02 PM
MatEditor.Open()

Opens the Material Editor

<bool>MatEditor.isOpen()

Returns true if the Material Editor is open

MatEditor.Close()

Closes the Material Editor

jimrim
07-07-2005, 08:21 PM
1. Material Editor can close --> thank you very much
but...
2. In fact, user want to add image from other location, may be not from same location of script.
3. I define a is global already, but I don't understand why Building not defined but if I open MaxScript Listener , print 'Building' and enter, Restart Script , error dispear and building can defined.
http://grad.fibo.kmutt.ac.th/temp/CameraMap.rar --> This is my script, help d/l and check this.

CGTalk Moderation
07-07-2005, 08:21 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.