CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 06-09-2013, 10:52 PM   #76
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
This is my final attempt
Code:
fn getRootGroupHead node = if isgroupMember node do ( while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent node ) getRootGroupHead $Box001
__________________
Looking in the right side. [bgaTools]
 
Old 06-09-2013, 11:42 PM   #77
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
Another functions
Code:
fn getRootGroupHead node = if isgroupMember node do ( while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent ) fn isReallyGeometry obj = isKindOf obj GeometryClass and canConvertTo obj Editable_Mesh fn getGeometryGroupMembers grp = if isGroupHead grp do ( local childrens = execute ("$"+grp.name+"...*") for c in childrens where isReallyGeometry c collect c ) rootGroup = getRootGroupHead $Box001 geoGroupMembers = getGeometryGroupMembers rootGroup
__________________
Looking in the right side. [bgaTools]

Last edited by gazybara : 06-10-2013 at 07:29 AM.
 
Old 06-10-2013, 06:44 AM   #78
lucky6969c
Frequenter
portfolio
Jack
Hong Kong, Hong Kong
 
Join Date: Oct 2009
Posts: 103
Thanks guys for putting efforts in, I am sick today too.
I wake up 2 o'clock this afternoon and wow 6 pages of responses.
Eat my hat.
Thanks
Jack
 
Old 06-10-2013, 07:38 AM   #79
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
Quote:
Originally Posted by lucky6969c
Thanks guys for putting efforts in, I am sick today too.
I wake up 2 o'clock this afternoon and wow 6 pages of responses.
Eat my hat.
Thanks
Jack

Thanks to Denis this thread has been turned into a battlefield.
If you want to learn something really cool and useful U need to jump here and survive.
__________________
Looking in the right side. [bgaTools]
 
Old 06-10-2013, 08:18 AM   #80
fajar
Frequenter
portfolio
fajar
Airdrie, Canada
 
Join Date: May 2009
Posts: 131
dont know about it but ...try.only

Code:
fn SS_findGroupHead node = ( if node.parent != undefined then ( if isgrouphead node.parent then return node.parent ) SS_findGroupHead node.parent )
 
Old 06-10-2013, 08:23 AM   #81
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
Quote:
Originally Posted by fajar
dont know about it but ...try.only

Code:
fn SS_findGroupHead node = ( if node.parent != undefined then ( if isgrouphead node.parent then return node.parent ) SS_findGroupHead node.parent )

We already tried with recursive function
__________________
Looking in the right side. [bgaTools]
 
Old 06-10-2013, 08:26 AM   #82
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,511
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
Another functions
Code:
fn getRootGroupHead node = if isgroupMember node do ( while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent ) fn isReallyGeometry obj = isKindOf obj GeometryClass and canConvertTo obj Editable_Mesh fn getGeometryGroupMembers grp = if isGroupHead grp do ( local childrens = execute ("$"+grp.name+"...*") for c in childrens where isReallyGeometry c collect c ) rootGroup = getRootGroupHead $Box001 geoGroupMembers = getGeometryGroupMembers rootGroup


i don't want disappoint you but both getRootGroupHead and getGeometryGroupMembers are not correct in general case.
#1 what if the node is a group head itself?
#2 what if we have more than one node with the same name as a group head?
 
Old 06-10-2013, 08:47 AM   #83
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
Quote:
Originally Posted by denisT
i don't want disappoint you but both getRootGroupHead and getGeometryGroupMembers are not correct in general case.
#1 what if the node is a group head itself?
#2 what if we have more than one node with the same name as a group head?

#1>>>
Code:
fn getRootGroupHead node = if isValidNode node do ( while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent )

#2>>> Can I use recursive fn?
__________________
Looking in the right side. [bgaTools]
 
Old 06-10-2013, 08:54 AM   #84
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,511
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
#1>>>
Code:
fn getRootGroupHead node = if isValidNode node do ( while node != undefined and (isgrouphead node.parent or isgroupmember node) do node = node.parent )

#2>>> Can I use recursive fn?

#1 wrong again
#2 you can use whatever you want but it doesn't need a recursion. first time on this forum the best method was shown by LO
 
Old 06-10-2013, 08:58 AM   #85
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
Quote:
Originally Posted by denisT
#1 wrong again
#2 you can use whatever you want but it doesn't need a recursion. first time on this forum the best method was shown by LO

I not have more ideas for #1
Can you show mystery code and "lo" method
__________________
Looking in the right side. [bgaTools]
 
Old 06-10-2013, 09:36 AM   #86
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,511
Send a message via ICQ to denisT
Code:
fn getRootGroupHead node = if isgroupmember node do ( while node != undefined and (not isgrouphead node or isgroupmember node) do (node = node.parent) node ) fn getGeometryGroupMembers node = if isgrouphead node do ( for node in (join #() node) where iskindof node geometryclass and canconvertto node editable_mesh collect node )
 
Old 06-10-2013, 09:50 AM   #87
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,103
Quote:
Originally Posted by denisT
Code:
fn getRootGroupHead node = if isgroupmember node do ( while node != undefined and (not isgrouphead node or isgroupmember node) do (node = node.parent) node ) fn getGeometryGroupMembers node = if isgrouphead node do ( for node in (join #() node) where iskindof node geometryclass and canconvertto node editable_mesh collect node )

fuc.....I miss that combo.
U are right. It's to perfect and simple to be true.
Second one... I don't know what to say...only I can take my hat off.
Thanks Denis for this lesson.
__________________
Looking in the right side. [bgaTools]
 
Old 06-10-2013, 05:34 PM   #88
miauu
Expert
 
miauu's Avatar
portfolio
Kostadin Kotev
Blagoevgrad, Bulgaria
 
Join Date: Sep 2009
Posts: 775
It's my turn to thank Denis - thank you.
 
Old 06-12-2013, 02:55 AM   #89
lucky6969c
Frequenter
portfolio
Jack
Hong Kong, Hong Kong
 
Join Date: Oct 2009
Posts: 103
Yeah, thanks a lot
 
Old 06-12-2013, 02:55 AM   #90
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:33 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.