PlotAndApplyActions function

Discussions concerning programming of SOFTIMAGE©
iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

PlotAndApplyActions function

Post by iamVFX » 28 Feb 2012, 15:03

Hello. I'm trying to plot some nulls, so I need all nine values of the transformations - translation, rotation and scale. The problem is: I have a one thousand of nulls and PlotAndApplyActions function can accept only one value of each of them. So 1000 objects multiply by 9 values of the transformations equal list of nine thousands string values. Is there a workaround for this situation, another command maybe? Thanks!

Code: Select all

null_name_list = []
for i in range(len(Application.Selection)):
	null_name_list.append(Application.Selection[i].FullName)

null_posx = [i+'.kine.local.posx' for i in null_name_list]
null_posy = [i+'.kine.local.posy' for i in null_name_list]
null_posz = [i+'.kine.local.posz' for i in null_name_list]
	
null_rotx = [i+'.kine.local.rotx' for i in null_name_list]
null_roty = [i+'.kine.local.roty' for i in null_name_list]
null_rotz = [i+'.kine.local.rotz' for i in null_name_list]

null_sclx = [i+'.kine.local.sclx' for i in null_name_list]
null_scly = [i+'.kine.local.scly' for i in null_name_list]
null_sclz = [i+'.kine.local.sclz' for i in null_name_list]
	
null_kinematics = ((null_posx + null_posy + null_posz) +
						(null_rotx + null_roty + null_rotz) +
						(null_sclx + null_scly + null_sclz))

null_kinematics_string = ','.join(str(n) for n in null_kinematics)

Application.PlotAndApplyActions(null_kinematics_string, "plot", 1, 100)

iamVFX
Posts: 697
Joined: 24 Sep 2010, 16:28

Re: PlotAndApplyActions function

Post by iamVFX » 29 Feb 2012, 07:42

Oh, I knew it would be easy :) The star char helps apply function for all selected objects [I always forget about it!]:

Code: Select all

Application.PlotAndApplyActions("*.kine.local.sclx,*.kine.local.scly,*.kine.local.sclz,*.kine.local.rotx,*.kine.local.roty,*.kine.local.rotz,*.kine.local.posx,*.kine.local.posy,*.kine.local.posz", "plot", 1, 100)