Notifications
Clear all

[Closed] Cloth Group Nodes

 MZ1

How we can get node, which cloth modifier/vertex group is attached to?

8 Replies

easy but not safe:

nodes = #()
for modi in (getclassinstances cloth) do join nodes (refs.dependentnodes modi)

and safe is:

nodes = #()
for nodes in geometry do 
(
    out = off
    for modi in node.modifiers while not out where (out = iskindof modi cloth) do append nodes node
)

second is also better because it gives you information what instance of cloth modifier is applied.

if you want to find all nodes of a specified modifier it’s

refs.dependentnodes modi -- unsafe
for node in (refs.dependentnodes modi) where finditem node.modifiers modi > 0 collect node -- safe
1 Reply
 MZ1
(@mz1)
Joined: 1 year ago

Posts: 0

Sorry , Let me explain my question again. I want to get nodes assigned to a group inside group subobject (subobject 1). We can assign it by using:

<void>makeConstraint groupname type  target_node 
 

but, I don’t know how we can get it.

it should make some dependency… try refs.dependents for modifier and refs.dependson for group head and group nodes

 MZ1

I can get all groups and all nodes, but I don’t know which node assigned to which group.

M = $Teapot001.cloth
 clearlistener()
 AllGroups = for i=1 to M.numsubs where (try(M[i].Group_Name)catch())!=undefined collect M[i]
 AllNodes = for n in (refs.dependson AllGroups[1]) where iskindof n node collect n

could you give us a simple example scene? it will save time for who wants to help you

1 Reply
 MZ1
(@mz1)
Joined: 1 year ago

Posts: 0

Select Plane001 and then go to the Modify Panel/Cloth modifier / Subobject 1 (group), you see “Group001 (node to Teapot001)” and “Group001 (node to Sphere001)” in the listbox, I want to get this data.

it seems like there is no safe way to get info about a node used by group. node is stored in private (hidden) parameter of modifier’s parameter block. and it’s stored with weak reference. so it’s not visible for ref system.
you can see dependency of group nodes and modifier but there is no way (i couldn’t find) what paramblock uses it.

of course always there is a way to read nodes from modifiers UI. but in this case the modifier has to be shown in the modifiers panel