View Full Version : selection list
loran 03-11-2004, 12:00 PM I would like to do a simple rollout with a listbox that show every object in the scene.
if selected in the list, object is unhide alone
the aim is to control a long list of object in a single scene without having to unhide by name, select then hide selection then unhide by name again etc...
I m sure its simple but I fail :/
|
|
gloupi
03-11-2004, 11:41 PM
Hello loran,
Try that, i hope it you wanted.;)
-----------------------------------------------
try(DestroyDialog ListObjHide)catch()
rollout ListObjHide "Visibility List" width:176 height:288
(
multilistBox LBox "" pos:[8,8] width:160 height:21
on ListObjHide open do
(
Obj = $Objects
Obj_name = for i in Obj collect i.name
Obj_Vis = #{}
for i = 1 to Obj.count do
(
Obj_Vis[i] = not(Obj[i].IsHidden)
)
LBox.items = Obj_name
LBox.selection = Obj_Vis
)
on LBox selected Id do
(
Obj_Name = ListObjHide.LBox.items[Id]
Obj_Vis = execute ("$"+Obj_Name+".IsHidden")
if Obj_Vis then execute ("$"+Obj_Name+".IsHidden = false ")
else execute ("$"+Obj_Name+".IsHidden = true")
)
)
CreateDialog ListObjHide
loran
03-12-2004, 08:41 AM
wooooooooooooooooooohouuuuuuuuuuuuuuuuuuuuu!!
excelent!!
Meeeeeeeeeeeeeeeerci man !!
exactement ce ke je voulais (meme mieux en fait)
chao
tu fais coi comme taff?
loran
03-12-2004, 08:57 AM
ARRRRRRhhh....
ton script ne prend pas en compte les noms d'objet avec des "-"
voici l'erreur :
"
------------------------------------------------------------------------------------
-- Error occurred during fileIn in StringStream:"$810-01-C.IsHidden"
-- Error occurred in LBox.selected()
-- Frame:
-- Obj_Vis: undefined
-- id: 272
-- Obj_name: "810-01-C"
>> MAXScript Rollout Handler Exception: -- No ""-"" function for undefined <<
------------------------------------------------------------------------------------
"
gloupi
03-12-2004, 01:32 PM
Ok,
Try this one, i just add then StringRemoveBadCharacter function which replace bad character by "_".
To add some "bad character" add it in line 'F = filterString Str " -+"'
ca fait plaisir de faire plaisir :bounce:
Pis sinon, je fais de la 3d, sur max.Ajourd'hui plutot pour une sorte de jeux video.Sinon un peu de tout.
:thumbsup:
------------------------------------------------------
try(DestroyDialog ListObjHide)catch()
rollout ListObjHide "Visibility List" width:176 height:288
(
local StringRemoveBadCharacter
fn StringRemoveBadCharacter Str =
(
local FinalStr =""
F = filterString Str " -+"
for i = 1 to (F.count-1) do
(
FinalStr += F[i] + "_"
)
FinalStr += F[F.count]
return FinalStr
)
multilistBox LBox "" pos:[8,8] width:160 height:21
on ListObjHide open do
(
Obj = $Objects
Obj_name = for i in Obj collect i.name
Obj_Vis = #{}
for i = 1 to Obj.count do
(
Obj_Vis[i] = not(Obj[i].IsHidden)
)
LBox.items = Obj_name
LBox.selection = Obj_Vis
)
on LBox selected Id do
(
Obj_Name = StringRemoveBadCharacter (ListObjHide.LBox.items[Id])
Obj_Vis = execute ("$"+Obj_Name+".IsHidden")
if Obj_Vis then execute ("$"+Obj_Name+".IsHidden = false ")
else execute ("$"+Obj_Name+".IsHidden = true")
)
)
CreateDialog ListObjHide
loran
03-12-2004, 01:44 PM
ca marche po
://
Cthulhu
03-12-2004, 08:18 PM
you should use the getNodeByName() function to directly get the object. try this:
on LBox selected Id do
(
obj = getNodeByName( ListObjHide.LBox.items[Id] )
if obj.isHidden then obj.ishidden = false
else obj.ishidden = true
)
gloupi
03-12-2004, 09:01 PM
Thx Cthulhu,
For the GetNodeByName that i sadly never seen before.
I have to better read the MXS Doc.When i think to the function i used instead of that, :blush:
I wonder it it would be usefull to expand that script, with the various objects type and Freeze.More, double click to select the objects.I rewrite it to work with the set camera to active viewport, and it was very helpfull.
loran,
As far as i tried the script worked, and nicer with the Cthulhu help.
I join the 2 macro.
Farthart
03-12-2004, 09:46 PM
:bounce: :bounce: :bounce:
loran
03-15-2004, 09:00 AM
Greeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaaaat!!!
that works fine chuchu !!
thanx for this!!
just another enhance requested ...:rolleyes:
can the list be sort by name (alphabetical) ?
thanx for all your post people
your so fine
:applause:
gloupi
03-15-2004, 10:06 AM
so
happy face man, i add it for you.
:shrug:
loran
03-15-2004, 10:12 AM
ouiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
ca marche monsieur kk !!
encore un dernier detail... pour faire chier
l'objet affiché doit etre selectionné
uh?
gloupi
03-15-2004, 10:43 AM
I say Warning,
want you to select only the last added objects or the complete list of visible objects.
:bounce:
T bien rapide a repondre, lol
loran
03-15-2004, 10:58 AM
I want the unhiden object to be selected. I can, that way, live control the polygon Count.
**********************
ba ué jai ksa a foutre ;p
gloupi
03-15-2004, 11:19 AM
Ok,
as i wonder how to animate the fish as i wonder why i do it.
;)
loran
03-15-2004, 11:49 AM
stange results
give it up its ok :)
are u really animating a fish?
CGTalk Moderation
01-17-2006, 05:00 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.