Notifications
Clear all

[Closed] Get objects mesh is wired to?

Is it possible via Maxscript to take a selected object, and find out what other objects in the scene its been wired to?

6 Replies
 JHN

Maybe you can be more specific? Wired in what way exactly?

Like using Wire Parameters to link a control/dummy object to a bones X/Y/Z rotations. So say I did this:

paramWire.connect $Sphere001.controller[#X_Rotation] $Bone001.rotation.controller[#X_Rotation] “X_Rotation”

How would I get what Sphere001 was linked to later on?

what do you know about $Sphere001? do you connect it yourself? or are you searching for possible ‘wire connections’?

 JHN

Ok, so here’s a way to find the source of a float wired object, finding a target is a bit more reverse engineering but could be done too. Not sure if it catches all corner cases, but it’s a start perhaps.
(and am I the only one that really hates the layout/formatting of cgtalk!?)

Cheers,
-johan


fn findFloatWireSource target =
(
	res = #()
	for c in (getClassInstances Float_Wire target:target) do 
	(
		local thisNodes = refs.dependentnodes c -- find target node, it also captures a instance of the target controller
		local refNodes = refs.dependentnodes c.slaveAnimation -- get slave nodes
		local othernodes = for r in refNodes where findItem thisNodes r == 0 collect r --filter out original source
		
		format "target : % | source : %
" target othernodes -- debug code
		
		join res othernodes -- return targets
	)
	res
)

sources = findFloatWireSource selection[1]

as i understood the question it’s how to find ‘slave’ node by ‘master’.

so with your approach you have to search a wire class controller in whole scene because you can’t know a target (as well as a number of targets)

 JHN

Jup, I don’t think there’s really any other way, as a “master controller” itself knows nothing about who’s asking him for it’s input. It’s “referenced” in the wire constraint as a track. Or do you have a better perspective?