How to pick a group object?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2013   #76
This is my final attempt

   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 June 2013   #77
Another functions

        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 June 2013 at 07:29 AM.
 
Old 06 June 2013   #78
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 June 2013   #79
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 June 2013   #80
dont know about it but ...try.only


fn SS_findGroupHead node =
(
if node.parent != undefined then
	(
	if isgrouphead node.parent then return node.parent 
	)
SS_findGroupHead node.parent
)
 
Old 06 June 2013   #81
Originally Posted by fajar: dont know about it but ...try.only


  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 June 2013   #82
Originally Posted by gazybara: Another functions

          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 June 2013   #83
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>>>
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 June 2013   #84
Originally Posted by gazybara: #1>>>
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 June 2013   #85
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 June 2013   #86

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 June 2013   #87
Originally Posted by denisT:

 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 June 2013   #88
It's my turn to thank Denis - thank you.
 
Old 06 June 2013   #89
Yeah, thanks a lot
 
Old 06 June 2013   #90
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



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 08:15 PM.


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