Trigger a block controler animation by script

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Display Modes
  03 March 2013
Trigger a block controler animation by script

Hey gang-
Is there a good way to trigger an animation, say with a block controller based on an objects proximity or a pflow system? Id prefer not to get pflow in the mix for this one but I'm up for options.

Thanks!

-Michael

Last edited by spaw : 03 March 2013 at 11:03 PM.
 
  03 March 2013
Could you describe a little more about what you are trying to achieve? Your question is a little cryptic and hard to figure out exactly what you are trying to achieve.

-Eric
__________________
"The Evil Monkey hiding in your closet."
 
  03 March 2013
it's definitely possible! but i agree with Eric... i've understood nothing what you're asking about
 
  03 March 2013
Trigger a block controler animation by script

he-he, its Friday and the language skill have turned to mush.

Sorry lets give a concrete example. Say I have a box and animate a twist on it over 30 frames. If I save out that animation with a block controller or cache I now want to make an array say 10x10of these boxes. I then want to have a sphere move close to some of the boxes and based on a proximity test trigger the animation. The animation could be set to loop/reset or a one off trigger.

Thats just a simple example but I hope it captures the essence of what im looking to do.

Thanks!

-Michael
 
  03 March 2013
ha! i have an idea for funny snippet. i will try to find a time tomorrow to make it.
 
  03 March 2013
Trigger a block controler animation by script

Game on.

Thanks Denis

-Michael
 
  03 March 2013
but i need a little assistance. i know that Europe wakes up earlier than America... could anyone give me a code that generates these two faces (sad & happy) with the same number of splines and knots. i need them to be used in the morpher...
these are the faces


sorry for the technique. it's the best that i could make on my phone.
Attached Images
File Type: png faces.png (7.9 KB, 10 views)

Last edited by denisT : 03 March 2013 at 12:04 AM.
 
  03 March 2013
Can it be all one shape and does it mater if its smooth, bezier or any other requirements?
 
  03 March 2013
well. max file is good. but i need a code that generates these faces.
 
  03 March 2013
Originally Posted by denisT: ha! i have an idea for funny snippet. i will try to find a time tomorrow to make it.

here is it:

plugin Helper Motivator
	classid:#(0x00001967, 0x12567814)
	extends:Point
	invisible:on
	autoPromoteDelegateProps:on
	replaceUI:on
(
	parameters params rollout:params
	(
		power type:#worldunits default:200 ui:ui_power
		on power set value do notifydependents this partid:#tm
	)
	rollout params "Parameters"
	(
		spinner ui_power "Power:" type:#worldunits fieldwidth:56 range:[0,1e9,50] offset:[4,0]
	)
)
bored =
#(
	#(
		#([67.082,0,0], [67.082,0,-37.0149], [67.082,0,37.0149]),
		#([-2.93225e-006,0,67.082], [37.0149,0,67.082], [-37.0149,0,67.082]),
		#([-67.082,0,-5.8645e-006], [-67.082,0,37.0149], [-67.082,0,-37.0149]),
		#([7.99945e-007,0,-67.082], [-37.0149,0,-67.082], [37.0149,0,-67.082])
	),
	#(
		#([38.9038,0,-17.7427], [30.6118,0,-12.7177], [47.1958,0,-22.7676]),
		#([50.3858,0,-27.7427], [49.4,0,-24.5004], [51.3717,0,-30.9849]),
		#([44.8188,0,-37.1961], [51.3818,0,-32.153], [38.2559,0,-42.2392]),
		#([0,0,-27.9188], [20.8993,0,-27.9188], [-20.8993,0,-27.9188]),
		#([-44.8581,0,-38.292], [-38.167,0,-43.3351], [-51.5492,0,-33.2489]),
		#([-50.3731,0,-27.7427], [-51.182,0,-31.1675], [-49.5642,0,-24.3178]),
		#([-40.0048,0,-17.7427], [-48.506,0,-22.7676], [-31.5037,0,-12.7177]),
		#([0.63382,0,-6.87366], [-18.9548,0,-6.87366], [20.2224,0,-6.87366])
	),
	#(
		#([45.2718,0,20], [45.2718,0,11.5732], [45.2718,0,28.4268]),
		#([30,0,35.2718], [38.4268,0,35.2718], [21.5732,0,35.2718]),
		#([14.7282,0,20], [14.7282,0,28.4268], [14.7282,0,11.5732]),
		#([30,0,4.72816], [21.5732,0,4.72816], [38.4268,0,4.72816])
	),
	#(
		#([-14.7282,0,20], [-14.7282,0,11.5732], [-14.7282,0,28.4268]),
		#([-30,0,35.2718], [-21.5732,0,35.2718], [-38.4268,0,35.2718]),
		#([-45.2718,0,20], [-45.2718,0,28.4268], [-45.2718,0,11.5732]),
		#([-30,0,4.72816], [-38.4268,0,4.72816], [-21.5732,0,4.72816])
	)
)

happy = 
#(
	#(
		#([67.082,0,0], [67.082,0,-37.0149], [67.082,0,37.0149]),
		#([-2.93225e-006,0,67.082], [37.0149,0,67.082], [-37.0149,0,67.082]),
		#([-67.082,0,-5.8645e-006], [-67.082,0,37.0149], [-67.082,0,-37.0149]),
		#([7.99945e-007,0,-67.082], [-37.0149,0,-67.082], [37.0149,0,-67.082])
	),
	#(
		#([38.9038,0,-10], [30.5061,0,-10.9865], [47.3014,0,-9.01352]),
		#([50.3858,0,-20], [50.171,0,-15.8473], [50.6007,0,-24.1527]),
		#([40.1929,0,-34.9161], [46.7559,0,-29.873], [33.63,0,-39.9592]),
		#([0,0,-50.2586], [20.8993,0,-50.2586], [-20.8993,0,-50.2586]),
		#([-40.0048,0,-34.9161], [-33.3137,0,-39.9592], [-46.696,0,-29.873]),
		#([-50.0097,0,-20], [-50.0097,0,-24.1527], [-50.0097,0,-15.8473]),
		#([-40.0048,0,-10], [-48.3398,0,-9.01352], [-31.6699,0,-10.9865]),
		#([0,0,-25.9189], [-19.5886,0,-25.9189], [19.5886,0,-25.9189])
	),
	#(
		#([50,0,20], [50,0,8.96428], [50,0,31.0357]),
		#([30,0,40], [41.0357,0,40], [18.9643,0,40]),
		#([10,0,20], [10,0,31.0357], [10,0,8.96427]),
		#([30,0,0], [18.9643,0,0], [41.0357,0,0])
	),
	#(
		#([-10,0,20], [-10,0,8.96428], [-10,0,31.0357]),
		#([-30,0,40], [-18.9643,0,40], [-41.0357,0,40]),
		#([-50,0,20], [-50,0,31.0357], [-50,0,8.96427]),
		#([-30,0,0], [-41.0357,0,0], [-18.9643,0,0])
	)
)
fn makeSpline data name: wirecolor:yellow = 
(
	sh = splineshape name:name wirecolor:wirecolor
	for dd in data do 
	(
		sp = addnewspline sh
		for d in dd do
		(
			k = addknot sh sp #bezier #curve d[1] d[2] d[3] 
		)
		close sh sp
	)
	updateshape sh
	sh
)
with redraw off
(
	delete objects
	max create mode

	source = makeSpline bored name:"Bored" wirecolor:yellow
	target = makeSpline happy name:"Happy" wirecolor:orange

	motive = Motivator name:"Motivator" power:200 wirecolor:red isselected:on
	motive.size = 100
	
	if isvalidnode (target = $Happy) and isvalidnode (source = $Bored) do
	(
		channel = 1
		addmodifier source (modi = Morpher name:"Motivation" autoload_of_targets:1)
		if (WM3_MC_BuildFromNode modi channel target) do
		(
			WM3_MC_SetActive modi channel on
			if name != unsupplied do WM3_MC_SetName modi channel target.name
			if value != unsupplied do WM3_MC_SetValue modi channel 0.0			
			WM3_RefreshChannelListUI modi
		)
	)
	
	c = modi[1].controller = Float_Script()
	c.addnode "source" source
	c.addnode "motive" motive
	ss = "if isvalidnode motive and motive.power != 0 then (100 - 100*(distance source motive)/motive.power) else 0\n"
	c.setexpression ss
	
	clones = #()
	for z=1 to 9 do for x=1 to 9 do
	(
		maxops.clonenodes source offset:[150*x,0,-150*z] cloneType:#copy expandHierarchy:on newNodes:&clones
		clones[1].motivation[1].controller.setnode "source" clones[1]
	)

	hide #(target, source)

	viewport.resetallviews()
	viewport.activeviewport = 2
	max select all
	max zoomext sel all
	max move
	motive.isselected = on
)


try to move the 'motive' node and change its "Power" property... enjoy!
 
  03 March 2013
as you see everything is animatable and renderable, and works in real-time update...
 
  03 March 2013
Denis-

Very cool, Thanks for the great example. though im still not sure how this can trigger a preset animation like one from a block controller. Im not even sure if the the block controllers are even acessable through script.

Thanks

-Michael
 
  03 March 2013
Originally Posted by spaw: Denis-

Very cool, Thanks for the great example. though im still not sure how this can trigger a preset animation like one from a block controller. Im not even sure if the the block controllers are even acessable through script.

are you talking about the Block Control node in the Global Tracks node of Track View?
 
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 09:59 AM.


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