Notifications
Clear all

[Closed] attach object/group to all group instances

No way. Only if I use Hold-Fetch fn.

nope… it can be done simply undoable with undo “…” on

what’s a reason to make the challenge if we have only one participant and only one judge?

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.

3 Replies
(@denist)
Joined: 1 year ago

Posts: 0

for example with your scene… try to select all things on the table and the table itself. and pick the table…

(@gazybara)
Joined: 1 year ago

Posts: 0

That is extreme situation when user accidentally select the wrong object.
I tried to make your first 2 fn’s


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?

(@denist)
Joined: 1 year ago

Posts: 0

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.

try to select only Teapot003 and pick the table… and a lot of other cases.

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.

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

and undo “Attach” on to pick object at least

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?

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

here is a sample of sensibly organized scene:
we have furniture items: tables, chairs, cocktail tables, etc.
we have some on table things: plates, forks, knives, glasses, etc

furniture might be grouped in groups: two chair table, three… four, double table, table and cocktail table…, etc.
table things also can be specifically grouped…

and now is the same task: Get a node (or many nodes from table things) or whole table thing group and attach it to any furniture group or just a member of the group.

does it make scene?
but the tool provided does do it for root heads only… and we can’t use only selected members to clone or attach to. Do we have to write new tool every time when we slightly modify the rules?

Page 3 / 4