Author Topic: Issue on changing graph output size in editor  (Read 1335 times)

Hi.

I'm am trying to change the output size of the sbsars programatically in editor.
For this I use this method :

Code: [Select]
        public static void UpdateSubstanceGraphDefinition(EditorAssetUtils.AssetData p_Asset, int p_Definition)
        {
            SubstanceGraph l_Graph = p_Asset.Assets.Find(o => o is SubstanceGraph) as SubstanceGraph;
            if (l_Graph == null) return;
                       
            SerializedObject l_SerializedObject = new SerializedObject(l_Graph);
            SerializedProperty l_List = l_SerializedObject.FindProperty("mTargetSettingList");
            l_List.GetArrayElementAtIndex(0).FindPropertyRelative("textureWidth").intValue = p_Definition;
            l_List.GetArrayElementAtIndex(0).FindPropertyRelative("textureHeight").intValue = p_Definition;
            l_SerializedObject.ApplyModifiedProperties();
            l_SerializedObject.Update();

            p_Asset.Assets.ForEach(EditorUtility.SetDirty);
            AssetDatabase.WriteImportSettingsIfDirty(p_Asset.AssetPath);
            AssetDatabase.ImportAsset(p_Asset.AssetPath);
        }

p_Asset is a struct which contains the path to the main substance asset and an array of all assets under the main asset.

it is working to the point where the size changes in inspector. Unfortunately the texture aren't generated. How am I supposed to do it ?

Thank you :)

I'm still stuck on this.

Weird that nobody have a clue !?

I think you need to kick off a re-render, using the following:

Code: [Select]

graph.QueueForRender();
Substance.Game.Substance.RenderSubstancesSync(); // Or Async if you prefer...

Does that work?

Just tried and it doesn't work :(