CGTalk > Software Specific Forums > Autodesk 3ds max > 3dsMax SDK and MaxScript
To minimize the ads you see on this page create a CGTalk account and log in HERE
Thread Closed share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 06-14-2013, 01:57 PM   #31
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
and make it undoable
 
Old 06-14-2013, 01:58 PM   #32
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,077
Quote:
Originally Posted by denisT
try the sample scene from try2script.
you script doesn't work right for it. you are doing a lot of unnecessary things (most are about opened groups)... the only function that you need for cloned selection is the function that returns only highest by hierarchy nodes. after that you have to clone only them with their children if the 'root' node is not a group member.
so you need three simple functions:
Code:
fn getRoot node nodes: = ... fn getRootNodes nodes: = ... mapped fn attachNodeToAllGroupInstances node group includeChildren:#all = ...

and this will be a line to call:
Code:
attachNodeToAllGroupInstances (getRootNodes nodes:(selection as array)) <group> includeChildren:#all

Again trying to make a challenge.
Ok. Why am I always the only one who participates?
__________________
Looking in the right side. [bgaTools]
 
Old 06-14-2013, 02:00 PM   #33
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,077
Quote:
Originally Posted by denisT
and make it undoable

No way. Only if I use Hold-Fetch fn.
__________________
Looking in the right side. [bgaTools]
 
Old 06-14-2013, 02:12 PM   #34
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
No way. Only if I use Hold-Fetch fn.

nope... it can be done simply undoable with undo "..." on
 
Old 06-14-2013, 02:24 PM   #35
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
Again trying to make a challenge.
Ok. Why am I always the only one who participates?

what's a reason to make the challenge if we have only one participant and only one judge?
 
Old 06-14-2013, 03:47 PM   #36
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,077
Hey Denis
I just try my tool on Mike's example in both max2012x64 and max2104x64 and works.
Can you tell me how not works for you.
__________________
Looking in the right side. [bgaTools]
 
Old 06-14-2013, 04:34 PM   #37
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
Hey Denis
I just try my tool on Mike's example in both max2012x64 and max2104x64 and works.
Can you tell me how not works for you.

for example with your scene... try to select all things on the table and the table itself. and pick the table...
 
Old 06-14-2013, 04:35 PM   #38
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
try to select only Teapot003 and pick the table... and a lot of other cases.
 
Old 06-14-2013, 04:38 PM   #39
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,077
Quote:
Originally Posted by denisT
for example with your scene... try to select all things on the table and the table itself. and pick the table...

That is extreme situation when user accidentally select the wrong object.
I tried to make your first 2 fn's
Code:
fn getRoot node = while obj.parent != undefined do obj = obj.parent fn getRootNodes nodes: = for o in nodes where o.parent == undefined and not isKindOf o TargetObject collect o

Now what?
__________________
Looking in the right side. [bgaTools]
 
Old 06-14-2013, 05:00 PM   #40
try2script
Expert
portfolio
Mike
Moldova
 
Join Date: Mar 2013
Posts: 451
Quote:
Originally Posted by gazybara
I just try my tool on Mike's example in both max2012x64 and max2104x64 and works.
Can you tell me how not works for you.


Sorry, that I was not here, because I was outside till now, and by the way, on the road I was thinking about operating just with groupheads from above - highest level and objects that are not group members, and it was surprising for me that I saw what Denis said:

Quote:
Originally Posted by denisT
the only function that you need for cloned selection is the function that returns only highest by hierarchy nodes. after that you have to clone only them with their children if the 'root' node is not a group member.


and I've just tried the Branko's script and it's working in my scene!
 
Old 06-14-2013, 05:09 PM   #41
gazybara
Architect
 
gazybara's Avatar
portfolio
Branko Živković
Freelancer
Niš, Serbia
 
Join Date: Apr 2011
Posts: 1,077
Quote:
Originally Posted by try2script
Sorry, that I was not here, because I was outside till now, and by the way, on the road I was thinking about operating just with groupheads from above - highest level and objects that are not group members, and it was surprising for me that I saw what Denis said:



and I've just tried the Branko's script and it's working in my scene!

Of coure it works, but Denis don't let me sleep peacefully .I am target here
U need to ask him how to make "all cases" perfect code.
__________________
Looking in the right side. [bgaTools]
 
Old 06-14-2013, 05:22 PM   #42
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
That is extreme situation when user accidentally select the wrong object.
I tried to make your first 2 fn's
Code:
fn getRoot node = while obj.parent != undefined do obj = obj.parent fn getRootNodes nodes: = for o in nodes where o.parent == undefined and not isKindOf o TargetObject collect o

Now what?


your concept of whole tool is very specific for current scene... if anything a little different it fails.
so if you want to make a general tool you have to solve two problems:
#1 what nodes can be cloned and attached to a group
#2 what group can be used as a destination group for attaching nodes

the answers:
#1 any node that is not an instance of the destination group
#2 any group!

the problem of #1 is to find only highest parents in the selection to clone and keep their hierarchy and apply new transform.
the problem of #2 is to return the right group head if any member (including the head itself) picked.
 
Old 06-14-2013, 05:28 PM   #43
try2script
Expert
portfolio
Mike
Moldova
 
Join Date: Mar 2013
Posts: 451
Branko, I'm so pleased for your hard work here! I will still try to get into this script dipper, and I will post my ideas!
Denis, I wander, how deep is your labyrinth of thinking! How do you see always so deep inside code?
 
Old 06-14-2013, 05:54 PM   #44
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,094
Send a message via ICQ to denisT
Quote:
Originally Posted by gazybara
Of coure it works, but Denis don't let me sleep peacefully.

and undo "Attach" on to pick object at least
 
Old 06-14-2013, 05:59 PM   #45
try2script
Expert
portfolio
Mike
Moldova
 
Join Date: Mar 2013
Posts: 451
one more case is when your source object is a part of an opened group = > in this case it should be detached and the added to the picked group
 
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 04:24 AM.


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