public void ConvertToProperty(bool exposed = false) { var desc = VFXLibrary.GetParameters().FirstOrDefault(t => t.model.type == (model as VFXInlineOperator).type); if (desc == null) { return; } var param = viewController.AddVFXParameter(Vector2.zero, desc); // parameters should have zero for position, position is help by the nodes param.SetSettingValue("m_Exposed", exposed); VFXSlot.CopyLinks(param.GetOutputSlot(0), model.GetOutputSlot(0), false); param.CreateDefaultNode(position); viewController.LightApplyChanges(); var paramController = viewController.GetParameterController(param); paramController.value = inputPorts[0].value; var paramNodeController = paramController.nodes.FirstOrDefault(); if (paramNodeController == null) { return; } viewController.PutInSameGroupNodeAs(paramNodeController, this); viewController.RemoveElement(this); }
public override sealed void Sanitize(int version) { var crossProduct = ScriptableObject.CreateInstance(typeof(CrossProduct)) as VFXOperatorNumericUniform; crossProduct.SetOperandType(typeof(Vector3)); VFXSlot.CopyLinksAndValue(crossProduct.inputSlots[0], inputSlots[0], true); VFXSlot.CopyLinksAndValue(crossProduct.inputSlots[1], inputSlots[1], true); VFXSlot.CopyLinks(crossProduct.outputSlots[0], outputSlots[0], true); VFXModel.ReplaceModel(crossProduct, this); }