Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / pickbutton and Groups
  RSS 2.0 ATOM  

pickbutton and Groups
Rate this thread
 
37793
 
Permlink of this thread  
avatar
  • IonDave
  • Posted: 15 December 2009 04:33 AM
  • Location: Lacey, WA
  • Total Posts: 40
  • Joined: 17 March 2009 07:43 PM

I want to be able to pick a group with pickbutton, but it only selects geometry even if the filter is set to (classof Dummy).

I’ve tried everything I can think of and nothing works. Can this be accomplished?



~Dave

http://www.max-realms.com - 3ds Max models, tutorials and forums

Max3-2010

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

It should work if the Group is Open so you can see the “bounding box” around the group. If the group is closed you’ll have to cheat a little…
NB. This won’t work (without some modification) for nested groups!

(
rollout pick_group_test 
"Pick Group Test"
   
(
   fn pick_filter obj 
=
      
(
      local is_OK 
false
      
if obj.parent != undefined then
         
if classof obj.parent == Dummy then
            
if isGroupHead obj.parent then
               is_OK 
true
      is_OK
      )
   pickbutton chooseit 
"Select Group" width:140 filter:pick_filter
   on chooseit picked obj 
do
      

      
if obj != undefined do
         
(
         chooseit
.text obj.parent.name
         )
      )
--end on
   )
--end rollout

try destroydialog pick_group_test catch()
createDialog pick_group_test
)


Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • IonDave
  • Posted: 15 December 2009 05:19 AM

Thanks, Steve. This will work well for me as there are not any nested groups. Would you mind elaborating on the cheat for closed groups?



~Dave

http://www.max-realms.com - 3ds Max models, tutorials and forums

Max3-2010

Replies: 1
/img/forum/dark/default_avatar.png

The pickbutton doesn’t like closed groups (as you found) so the “cheat” is in the filter function - it is testing that the object under the cursor has a parent, that the parent is a Dummy and that the parent has its “group head” property set. If all 3 conditions are true then you are over an object in a closed group, so you can get at the group via the object’s Parent property.

Author: Steve_Curley

Replied: 15 December 2009 05:26 AM  
avatar
  • IonDave
  • Posted: 15 December 2009 05:27 AM

Oh! Your script already has the cheat in place. Nice! :D

Thanks for the help.



~Dave

http://www.max-realms.com - 3ds Max models, tutorials and forums

Max3-2010

Replies: 0