<commit_before>﻿using Gum.DataTypes;
using Gum.Managers;
using Gum.Wireframe;
using Microsoft.Xna.Framework.Graphics;
using RenderingLibrary;
using RenderingLibrary.Content;
using RenderingLibrary.Graphics;
using RenderingLibrary.Math.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GumRuntime
{
    public static class InstanceSaveExtensionMethods
    {
        public static GraphicalUiElement ToGraphicalUiElement(this InstanceSave instanceSave, SystemManagers systemManagers)
        {

            ElementSave instanceElement = ObjectFinder.Self.GetElementSave(instanceSave.BaseType);

            GraphicalUiElement toReturn = null;
            if (instanceElement != null)
            {
                toReturn = ElementSaveExtensions.CreateGueForElement(instanceElement);

                GumRuntime.ElementSaveExtensions.SetGraphicalUiElement(instanceElement, toReturn, systemManagers);

                toReturn.Name = instanceSave.Name;
                toReturn.Tag = instanceSave;

                var state = instanceSave.ParentContainer.DefaultState;



                foreach (var variable in state.Variables.Where(item => item.SourceObject == instanceSave.Name))
                {
                    string propertyOnInstance = variable.Name.Substring(variable.Name.LastIndexOf('.') + 1);<commit_msg>Part 2 of the exposed variable fix - variables are only set if the SEtsValue is true when creating instances.<commit_after>﻿using Gum.DataTypes;
using Gum.Managers;
using Gum.Wireframe;
using Microsoft.Xna.Framework.Graphics;
using RenderingLibrary;
using RenderingLibrary.Content;
using RenderingLibrary.Graphics;
using RenderingLibrary.Math.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GumRuntime
{
    public static class InstanceSaveExtensionMethods
    {
        public static GraphicalUiElement ToGraphicalUiElement(this InstanceSave instanceSave, SystemManagers systemManagers)
        {

            ElementSave instanceElement = ObjectFinder.Self.GetElementSave(instanceSave.BaseType);

            GraphicalUiElement toReturn = null;
            if (instanceElement != null)
            {
                toReturn = ElementSaveExtensions.CreateGueForElement(instanceElement);

                GumRuntime.ElementSaveExtensions.SetGraphicalUiElement(instanceElement, toReturn, systemManagers);

                toReturn.Name = instanceSave.Name;
                toReturn.Tag = instanceSave;

                var state = instanceSave.ParentContainer.DefaultState;



                foreach (var variable in state.Variables.Where(item => item.SetsValue && item.SourceObject == instanceSave.Name))
                {
                    string propertyOnInstance = variable.Name.Substring(variable.Name.LastIndexOf('.') + 1);
{'fraction_non_alphanumeric': 0.07142857142857142, 'fraction_numerical': 0.0010452961672473868, 'mean_word_length': 3.166908563134978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6609317', 'n_tokens_mistral': 728, 'n_tokens_neox': 692, 'n_words': 158}