getTransformData method

dynamic getTransformData(
  1. dynamic model,
  2. Map modelNode
)

Implementation

getTransformData(model, Map modelNode) {
  var transformData = {};

  if (modelNode["InheritType"] != null) transformData["inheritType"] = parseInt(modelNode["InheritType"]["value"]);

  if (modelNode["RotationOrder"] != null) {
    transformData["eulerOrder"] = getEulerOrder(modelNode["RotationOrder"]["value"]);
  } else {
    transformData["eulerOrder"] = 'ZYX';
  }

  if (modelNode["Lcl_Translation"] != null) transformData["translation"] = modelNode["Lcl_Translation"]["value"];

  if (modelNode["PreRotation"] != null) transformData["preRotation"] = modelNode["PreRotation"]["value"];
  if (modelNode["Lcl_Rotation"] != null) transformData["rotation"] = modelNode["Lcl_Rotation"]["value"];
  if (modelNode["PostRotation"] != null) transformData["postRotation"] = modelNode["PostRotation"]["value"];

  if (modelNode["Lcl_Scaling"] != null) transformData["scale"] = modelNode["Lcl_Scaling"]["value"];

  if (modelNode["ScalingOffset"] != null) transformData["scalingOffset"] = modelNode["ScalingOffset"]["value"];
  if (modelNode["ScalingPivot"] != null) transformData["scalingPivot"] = modelNode["ScalingPivot"]["value"];

  if (modelNode["RotationOffset"] != null) transformData["rotationOffset"] = modelNode["RotationOffset"]["value"];
  if (modelNode["RotationPivot"] != null) transformData["rotationPivot"] = modelNode["RotationPivot"]["value"];

  model.userData["transformData"] = transformData;
}