PDA

View Full Version : How to see bitmap in rollout?


le_faya
12-15-2006, 05:15 PM
Hi all,

I just start MaxScript and I would like to load bitmap of few character in a rollout and choose the map using the "chooseCharacter" dorpdownlist..
But i cannot load the map at first :)
And i will try to change it after this :)

my script:


(

rollout modelInterface "modelInterface"

(

Dropdownlist chooseCharacter "Choose Character" items: #("JON","BOB","PAUL");

)



rototoMap = bitmap 370 470

rototoMap.filename = "E:\Alex\TeteMeshRef.jpg"

createDialog modelInterface pos: [1650, 0] width:370 height: 470 bitmap:rototoMap

)



thnaks for your help

++

Alex

ypuech
12-15-2006, 06:04 PM
Hi Alex,

Use :

(

rollout modelInterface "modelInterface"
(
dropdownlist chooseCharacter "Choose Character" items: #("JON","BOB","PAUL");
)

createDialog modelInterface pos: [1650, 0] width:370 height: 470 bitmap:(openBitMap "E:\\Alex\\TeteMeshRef.jpg")

)

You cannot load/open a bitmap using .filename property. This attribute is just used when you want to create one. See MAXScript reference for more infos.

PS: Please use [code] tag when inserting script code; your post will be more easy to read :).

le_faya
12-15-2006, 07:07 PM
Thanks a lot for your help.
I promise i will use tag for next time :)
And maybe you could help me for another thing: i try to use the items of the dropdownlist to use this name in the bitmap path; for example if i choose "JON" i would like to load the "E:\Alex\JON.jpg"
(i was looking in the Maxscrip help but i don't already understand how to use it....I am making tutorials for the moment....if you have any good advice for me...i am ok :) )

THANKS

Alex

ypuech
12-15-2006, 07:29 PM
Hi Alex,

You can use .selected property returning the text of the current selected item. Also, you have to add "on selected" event function in the rollout definition to be called when an item in the dropDownList is selected :

rollout modelInterface "modelInterface"
(
dropDownList chooseCharacter "Choose Character" items: #("JON","BOB","PAUL");

on chooseCharacter selected Idx do
(
bmp = openBitMap ("E:\\Alex\\" + chooseCharacter.selected +".jpg")
SetDialogBitmap modelInterface bmp
)
)

createDialog modelInterface pos: [1650, 0] width:370 height: 470 bitmap:(openBitMap "E:\\Alex\\JON.jpg")

)

le_faya
12-18-2006, 11:36 AM
Thanks a lot for your help.
I need just few explanations if could be possible :)






rollout modelInterface "modelInterface"
(
dropDownList chooseCharacter "Choose Character" items: #("JON","BOB","PAUL");

on chooseCharacter selected Idx do
(
bmp = openBitMap ("E:\\Alex\\" + chooseCharacter.selected +".jpg")
SetDialogBitmap modelInterface bmp
)
)

createDialog modelInterface pos: [1650, 0] width:370 height: 470 bitmap:(openBitMap "E:\\Alex\\JON.jpg")

)


For the <arg> Idx you can put any name, or this is a special argument?
And the SetDialogBitmap, is it a function or something else? what is the interest i didn't find it in Maxscript help.
And i try to do this:



(

rollout modelInterface "modelInterface"

(

Dropdownlist chooseCharacter "Choose Character" items: #("Winston","Rototo");



on chooseCharacter selected Idx do

(

bmpCharacter = chooseCharacter.selected

bmpCharacter as string

)

)

--open the rollout with the bitmap of the current character

createDialog modelInterface width:370 height: 470 pos:[1650, 0] bitmap:openBitMap ("Y:\DATA_DEF\3D\Macros_DesorientExpress\Bitmap\" + bmpCharacter + ".JPG")

)






but i have this error:


-- Syntax error: at bad, expected <keyword arg>

-- In line: createDialog modelInterface width:370 height: 470 pos:[1650, 0] bitmap:openBitMap ("Y:\D




Thanks


PS:je peux te reecrire ca en francais si tu veux, parceque mon anglais c'est pas la fete.

ypuech
12-18-2006, 11:54 AM
Hi,

You can find informations in "Scripted Dialogs" section in the reference. Search for "createDialog" in the help.

You can put any variable name for the Idx argument. It returns the current selected index in the list.

You have this error because bmpCharacter is defined only in the function on..selected.

Here is the code if you want to set the bitmap at startup :

(

rollout modelInterface "modelInterface"
(
dropdownlist chooseCharacter "Choose Character" items: #("Winston","Rototo")

fn setCurrentSelectedBitmap =
(
bmp = openBitMap ("E:\\Alex\\" + chooseCharacter.selected +".jpg")
SetDialogBitmap modelInterface bmp
)

on modelInterface open do
(
setCurrentSelectedBitmap()
)

on chooseCharacter selected Idx do
(
setCurrentSelectedBitmap()
)
)

createDialog modelInterface width:370 height: 470 pos:[1650, 0]

)

on modelInterface open function is used to set the bitmap when the rollout is open. I've also created setCurrentSelectedBitmap() to factorize the code.

PS:We are in an English speaking only forum. But you can reach me on this French/English speaking forum :) : http://dl3d.free.fr/phpBB2/index.php

le_faya
12-18-2006, 12:54 PM
FANTASTIC :) big thx you help me to understand more about how to use the MaxScript help, and your scrip is (i imagine easy for you) excatly what i would like to do.
Thanks again.
And i will come on your forum, seems really good .

++

Alex

le_faya
12-18-2006, 05:10 PM
Damn Script, this will never end!!
I got a problem to get a position for the bitmap, i only find the "bmpstyle" of the createDialog function ; and i cannot give a real position with this option.

I trie to use the Utiltys but i didn't see where to use what i have created.

So I tried to use the subrollout who seems good for this.
I create one subrollout for the "ChooseCharacter"'s part (where the bitmap will be load) and another one for the other options.
The script seems to work, there is no maxScript error but i cannot see the bitmap.



--global rollout

rollout Global "Global" height: 950 width:450

(

subrollout GlobalPart1 "GlobalPart01" height:700 pos:[10,0]

subrollout GlobalPart2 "GlobalPart02" height:200 pos:[10,720]

)





--choose model rollout

rollout modelInterface "modelInterface" height:650 width:450

(

Dropdownlist chooseCharacter "Character" items: #("Winston","Rototo") pos:[10,30];

groupBox groupCharacter "ChooseCharacter" pos:[7,5] width:400 height: 660



fn setCurrentSelectedBitmap =

(

bmp = openBitMap ("Y:\\DATA_DEF\\3D\\Macros_DesorientExpress\\Bitmap\\" + chooseCharacter.selected +".jpg")

SetDialogBitmap modelInterface bmp

)



on modelInterface open do

(

setCurrentSelectedBitmap()

)



on chooseCharacter selected Idx do

(

setCurrentSelectedBitmap()

)

)





--specific control rollout (for the current character selected)

rollout ControlInterface "Control Interface" height:150 width:450

(

spinner sp_StrechAndSquash_armL "StrechAndSquash Bras Gauche" range:[0,100,20] fieldwidth:200 pos:[10,30] align:#center

groupBox groupBras "Bras" pos:[5,0] width:400 height: 150

)





--create final rollout



createdialog Global

AddSubRollout Global.GlobalPart1 modelInterface

AddSubRollout Global.GlobalPart2 ControlInterface








Sorry to ask again for your help, but i am loosing all my hairs..... :)

And with this method how could i called the "chooseCharacter.items" of the first rollout in the other (it seems to get no relation between the both). Create World variable could be a solution??

Thanks

Alex

ypuech
12-18-2006, 09:36 PM
Hi Alex,

In fact the bitmap clause in createDialog is used to set a background image to the rollout.
In your case, you need a bitmap control inside the rollout. Here is the code :

(

rollout uiMainRollout "Character setup" height: 950 width:450
(
subrollout uiModelBrowserSubRollout "" height:700 pos:[10,0]
subrollout uiModelSetupSubRollout "" height:200 pos:[10,720]
)

-- Choose model rollout
rollout uiModelBrowserRollout "Model Browser" height:650 width:450
(
groupBox grpCharacter "Character" pos:[7,5] width:400 height:660
dropdownlist ddlCharacter "Choose Character:" items: #("Winston","Rototo") pos:[10,30]
bitmap bmpCharacter pos:[15,90]

fn SetCurrentSelectedCharacter =
(
bmpSelected = openBitMap ("Y:\\DATA_DEF\\3D\\Macros_DesorientExpress\\Bitmap\\" + ddlCharacter.selected +".jpg")
bmpCharacter.bitmap = bmpSelected
)

fn GetCurrentSelectedCharacter =
(
-- Return
ddlCharacter.selected
)

on uiModelBrowserRollout open do
(
SetCurrentSelectedCharacter()
)

on ddlCharacter selected Idx do
(
SetCurrentSelectedCharacter()
)
)

-- Specific control rollout (for the current character selected)
rollout uiModelSetupRollout "Model Setup" height:150 width:450
(
spinner spnStrechAndSquash_ArmL "StrechAndSquash Bras Gauche" range:[0,100,20] fieldwidth:200 pos:[10,30] align:#center
groupBox grpBras "Bras" pos:[5,0] width:400 height:150
)

-- Create final rollout
createdialog uiMainRollout
AddSubRollout uiMainRollout.uiModelBrowserSubRollout uiModelBrowserRollout
AddSubRollout uiMainRollout.uiModelSetupSubRollout uiModelSetupRollout

)

i will come on your forum

It's not my forum. It's the forum of a good friend :).

le_faya
12-19-2006, 08:31 PM
Thanks a lot ypuech for the time you spend to answer me!!

++

Alex

CGTalk Moderation
12-19-2006, 08:31 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.