コード例 #1
0
def PC_Auto_Rigging_Car_Execute(  ):

	Application.LogMessage("PC_Auto_Rigging_Car_Execute called",c.siVerbose)
	
	##Start by pikking the geometry groups
	PickTheBody = Tools.MsgBox("Pick the Body Group","PICK THE BODY")
	if PickTheBody != 2 and  3:	
		BodyGroup = Tools.PickGroup()
		XSIZE = Tools.GetBoundingGroupSize(BodyGroup)
		PickTheWheels = Tools.MsgBox("Pick the Wheels GROUP","PICK THE WHEELS")
		if PickTheWheels != 2 and 3:
			WheelGroup = Tools.PickGroup()
			BodyGroupObjs=BodyGroup.Members
			WheelGroupObjs=WheelGroup.Members
			
			#Create A Null for the Rig whith an ice tree
			RIGMASTER = CarRigT.RigMasterNull("CAR_RIG",True,True,True)
			RIG = RIGMASTER[0]
			IceTreeRIG = RIGMASTER[1]
			EXECUTErot = RIGMASTER[2]
			EXECUTErotPort = 1
			
			#Create a Null fot MoveControl and one for the geometry
			CarMove = CarRigT.CarMovController(RIG,XSIZE,BodyGroupObjs)
			CARmov = CarMove[0]
			CARBodyGeo = CarMove[1]
				
			DIRECTION_WHEELS = []
			
			for Obj in WheelGroupObjs:
				RotationControls = CarRigT.CreateRotationControl(Obj,DIRECTION_WHEELS,CARmov)
				DIR = RotationControls[0]
				Cv = RotationControls[1]
				#Add the IceCompounds to rotate the wheel
				#CarRigT.AddRotationCompounds(IceTreeRIG,EXECUTErotPort,DIR,Cv,EXECUTErot)
				#EXECUTErotPort = EXECUTErotPort + 1
				
			#Create a compound with all the Rotatio Nodes	
			#ROTATION_WHEELS = app.CreateICECompoundNode(str(IceTreeRIG)+".*","ROTATION_WHEELS")
			
			#Set the Raycast Mode
			PickTheGround = Tools.MsgBox("Do you want to constrain on a surface or various?Just Pick a GROUP whit IT!","SELECT A GROUP whit SURFACE TO CONSTRAIN")
			if PickTheGround != 2 and 3:
				Surface = Tools.PickGroup()
				EXECUTEposport = 1
				rycst = CarRigT.RAYCAST_SURRFACE(DIR,CARmov,Surface)#Create a surface, a lattice whith clusters ald nulls and an ICETREE
				CarRigT.ApplyRaycast(DIRECTION_WHEELS,IceTreeRIG,EXECUTEposport)#Create the nodes to drive the wheels position with the nulls Raycast
				Tools.ApplySurfaceConstr(CARBodyGeo,rycst)
				#Translate all the body objs to the inial ZEROZERO because of the surfcnstr
				for Obj in BodyGroupObjs:
					Application.Translate(Obj, 0, 0, 0,"siAbsolute","siGlobal")
					
			#Create a Model with the car and groups	
			L=[RIG,WheelGroup,BodyGroup,Surface]
			s=app.SelectObj(L)
			RIG_mdl=app.CreateModel(s, "CAR_RIG_MDL", "", "")
		return true
	# 
	return true