private JSONClass GetPersonJson() { JSONClass json = new JSONClass { ["storables"] = new JSONArray() }; JSONStorable control = containingAtom.GetStorableByID("control"); json["storables"].Add(control.GetJSON()); foreach (string id in animationStorableIds) { JSONClass controlJson = containingAtom.GetStorableByID(animationStorableIdToControlId(id)).GetJSON(); JSONClass animationJson = containingAtom.GetStorableByID(id).GetJSON(); if (animationJson["steps"].AsArray.Count > 0) { json["storables"].Add(animationJson); //JSONClass animationStepJson = (animationJson["steps"].AsArray)[0].AsObject; //modifyControlJsonForSave(controlJson, animationStepJson); } //else //{ // modifyControlJsonForSave(controlJson, null); //} json["storables"].Add(controlJson); } return(json); }
private void DoAnalysisTimeline(JSONStorable timelineStorable) { var timelineScript = timelineStorable as MVRScript; if (timelineScript == null) { return; } var timelineJSON = timelineStorable.GetJSON()["Animation"]; var pluginsJSON = timelineScript.manager.GetJSON(); var pluginId = timelineScript.storeId.Substring(0, timelineScript.storeId.IndexOf("_", StringComparison.Ordinal)); var path = pluginsJSON["plugins"][pluginId].Value; var regex = new Regex(@"^[^.]+\.[^.]+\.([0-9]+):/"); var match = regex.Match(path); var version = !match.Success ? path : match.Groups[1].Value; var master = timelineJSON["Master"].Value == "1"; if (master) { _masters++; } var syncWithPeers = timelineJSON["SyncWithPeers"].Value != "0"; var clipsJSON = timelineJSON["Clips"].AsArray; string hasZeroSpeed = null; foreach (JSONClass clipJSON in clipsJSON) { var name = clipJSON["AnimationName"].Value; var loop = clipJSON["Loop"].Value == "1"; var speed = clipJSON["Speed"].AsFloat; if (speed == 0) { hasZeroSpeed = name; } if (syncWithPeers) { bool otherLoop; if (_looping.TryGetValue(name, out otherLoop)) { if (loop != otherLoop) { _loopingMismatches.Add(name); } } else { _looping.Add(name, loop); } } } _resultBuffer.AppendLine($"<b>{timelineScript.containingAtom.uid} {pluginId}</b>"); _resultBuffer.AppendLine($"- version: {version}"); _resultBuffer.AppendLine($"- clips: {clipsJSON.Count}"); if (!match.Success) { _resultBuffer.AppendLine($"- <color=yellow>Not from a known var package</color>"); } if (hasZeroSpeed != null) { _resultBuffer.AppendLine($"- <color=yellow>Clip '{hasZeroSpeed}' has a speed of zero, which means it will not play</color>"); } _resultBuffer.AppendLine(); }