//public CamPlanStep(IOperator groundAction, CamSchema camObject, List<CamTargetSchema> targets) : base(groundAction) //{ // // make a clone // var camObjectClone = GameObject.Instantiate(camObject.gameObject); // CamObject = camObjectClone.GetComponent<CamAttributesStruct>(); //} public new CamPlanStep Clone() { //var baseClone = base.Clone() as PlanStep; var newstep = new CamPlanStep(base.Clone() as PlanStep); //if (CamObject != null && CamObject != "") //{ // var parent = GameObject.Find("Cameras"); // var camPlanStepsObject = GameObject.Find("CamPlanSteps").gameObject; // var possibleCamObj = FindUnderParent(parent.gameObject, CamObject); // if (possibleCamObj == null) // { // possibleCamObj = FindUnderParent(camPlanStepsObject, CamObject); // } // GameObject newGO = GameObject.Instantiate(possibleCamObj); // newGO.transform.parent = camPlanStepsObject.transform; // newstep.CamObject = newGO.name; //} if (CamDetails != null) { newstep.CamDetails = CamDetails.Clone(); } if (TargetDetails != null) { newstep.TargetDetails = TargetDetails.Clone(); } return(newstep); }
public CamPlanStep ReadCamStepVariable(ClipSchema <DiscourseAsset> discClip) { /* Input: the ClipSchema<DiscourseAsset> * Output: A camera plan step (type CamPlanStep) representing a single durative camera action/shot * * CamPlanStep references * A specific Camera GameObject (cloned) * A specific target transform to focus on * A set of action segments which can be used to specify duration */ // Now doing this in Read() //UpdateActionSegmentsWithPercentages(discClip); // The Terms of the camera plan step are just its scale, hangle, vangle, and the location of the target. var termList = new List <ITerm>() { new Term(discClip.asset.camSchema.scale.ToString(), true) as ITerm, new Term(discClip.asset.camSchema.hangle.ToString(), true) as ITerm, new Term(discClip.asset.camSchema.vangle.ToString(), true) as ITerm, new Term(discClip.asset.camSchema.targetLocation.ToString(), true) as ITerm }; // include here, other constraints that can be tacked on, like horizontal and vertical damping, amount of lead time, etc. Can we just display the entire cinemachine camera body? // Since there's a list of action segments, specifying just one is not good. // new Term(actionSeg.actionVarName.ToString(), true) as ITerm, // new Term(actionSeg.startPercent.ToString(), true) as ITerm, // new Term(actionSeg.endPercent.ToString(), true) as ITerm //}; foreach (var constraint in discClip.asset.Constraints) { var constraintParts = constraint.Split(' '); // depreciated - specific object targets would be specified in target details (CamTargetSchema) //if (constraintParts[0].Equals("target")) //{ // termList.Add(new Term(constraintParts[1], true) as ITerm); //} // special constraints for different kinds of targets? Here, would create a new target and perhaps merge 2 targets? if (constraintParts[0].Equals("2-shot")) { // create new target here? } // TODO: do something with them. so far, unneeded... } // Create the CameraPlanStep CamPlanStep ps; var root = new Operator(new Predicate("", termList, true), new List <IPredicate>(), new List <IPredicate>()); ps = new CamPlanStep(root as IOperator); // Assign updated target Schemata ps.TargetDetails = discClip.asset.targetSchema; // Assign CamSchema, will be used to filter valid camera objects (CamAttributesStruct) ps.CamDetails = discClip.asset.camSchema; return(ps); }