GithubHelp home page GithubHelp logo

Comments (31)

Seneral avatar Seneral commented on June 21, 2024

Which version are you using? There seem to be problems with the latest 5.3.5 which I didn't adress yet...

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

I pulled from develop, so the latest. o.0 I needed the save/load to/from scene functionality. D:

I can still test/develop (still can reference scene gameobjects/components) so I'll sit tight until it's fixed. :) Any way I could "refresh" the save data? It doesn't matter if I lose anything (for right now at least).

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Sorry I meant the Unity version 5.3.5:)

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

Oh! Well I have multiple versions of Unity installed, but for this project, I'm using Unity 5.3.4.

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Huh, then this is should not be a problem. Any way you can reproduce it? I am experiencing no problems here... Or maybe I did something to fix it but did not publish yet? 😕

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

It worked for me for an entire week straight. o.0

I downloaded it on Monday I think, so maybe you fixed it after?

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Nope I did not work on the project too much the past weeks...
Anyway, if I stumble over this error myself I might have a chance to track it down but for me it's currently working:/

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

I think it might be triggered if the saved canvas in the entry is null. This is not possible if the canvas is correctly serialized into the scene. It might be related to that atleast, means there is most likely a bug in the seperation of the scene canvases from the asset saves...
Atleast it's a start. But I won't have time for now:(

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

Okay no worries - I'll look into it and try and figure it out!

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

My subscribing/unsubscribing to/from delegates stopped working also - might these be related?

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Weird, these are not connected at all - what do you mean with 'stopped working'? There's no hacky code or something like that could break easily, it's simple callback/delegate logic....
Did you change anything? ;)

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

I have the same code, but added a second one:

// Use this for initialization
public void OnEnable() {

    // On add requirement
    NodeEditorCallbacks.OnAddConnection -= OnAddRequirement;
    NodeEditorCallbacks.OnAddConnection += OnAddRequirement;

    // On remove requirement
    NodeEditorCallbacks.OnRemoveConnection -= OnRemoveRequirement;
    NodeEditorCallbacks.OnRemoveConnection += OnRemoveRequirement;
}

It incrementally calls the methods. So it calls it once, than twice, than three times, etc.

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

And without it works?
Isn't it called or is an error thrown?

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

Saving/Loading
I went to a new scene and the loading/saving to/from scene worked (this issue caused errors) - one of the hidden components related to the node editor must have gotten corrupt. What would be the best way to "flush" these?

Delegates
Still no luck with delegates though - still trying to fix that. The delegates work in that the code in called and it causes no errors. But, it doesn't appear to be unsubscribing properly since it calls the function more each time. So the first time it calls it once. Then twice. Then three times. And so on.

When I remove the newly added subscription, it still doesn't work even though that same code worked last week (breaks exactly as described above). Maybe the delegates working but another issue is causing it to re-call itself more and more each time?

EDIT: Fixed (delegate issue), I'm dumb.

I figured it out... My bad. Just in-case you're curious, here's what I did:

// On add 
            NodeEditorCallbacks.OnAddConnection -= OnRemoveRequirement; // added this first time on accident and it never got out of the system
            //NodeEditorCallbacks.OnAddConnection -= OnAddRequirement; // correct code - wrote after
            NodeEditorCallbacks.OnAddConnection += OnAddRequirement;

            // On remove requirement
            NodeEditorCallbacks.OnRemoveConnection -= OnAddRequirement; // added this first time on accident and it never got out of the system
            NodeEditorCallbacks.OnRemoveConnection -= OnRemoveRequirement; // correct code - wrote after
            NodeEditorCallbacks.OnRemoveConnection += OnRemoveRequirement;

Sorry for wasting your time. D:

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Alright, good you resolved that:) You're not wasting my time, I'm happy to help you out getting something useful from this project:)

To remove your corrupted saves, although not a fix, replace the first two methods and add the third one in NodeEditorSaveManager (attention pseudo code!):

/// <summary>
/// Gets all existing stored saves in the current scene and returns their names
/// </summary>
public static string[] GetSceneSaves ()
{
    return GetAllSaves ().Select (((NodeCanvasSceneSave save) => save.savedNodeCanvas.name)).ToArray ();
}

/// <summary>
/// Finds a scene save in the current scene with specified name or null if it does not exist
/// </summary>
private static NodeCanvasSceneSave FindSceneSave (string saveName)
{
    return GetAllSaves ().Find ((NodeCanvasSceneSave save) => save.savedNodeCanvas.name == saveName);
}

/// <summary>
/// Flushes corrupted scene saves and returns all others
/// </summary>
private static List<NodeCanvasSceneSave> GetAllSaves ()
{ // TODO: Fix cause of occasionally corrupted saves
    FetchSceneSaveHolder ();
    List<NodeCanvasSceneSave> saves = sceneSaveHolder.GetComponents<NodeCanvasSceneSave> ().ToList ();
    for (int cnt = 0; cnt < saves.Count; cnt++) 
    {
        if (saves[cnt].savedNodeCanvas == null) 
        { 
            saves.RemoveAt (cnt); 
            cnt--; 
            Debug.LogWarning ("Deleted one corrupted scene save!"); 
        }
    }
    return saves;
}

That will do for now until I find a fix for the real cause;)

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

Thank you for that ^^^ ! :D

So.. delegates seem to be acting funky still. Occasionally they start behaving as before or stop working altogether. When I restart Unity, it usually starts working again. It stops working altogether super frequently now.. like OnEnable() won't even be called. o.0

But if OnEnable isn't working, isn't it a Unity related issue?

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

That sounds to me like serialization issues...
Where/When do you subscribe to these events, in an editor script, a monobehaviour at runtime, etc. ?
And if OnEnable isn't called than it's something other out of the frameworks boundaries I suppose:/ Still no problem to ask if you need help;)

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

So it seems that it's breaking after each compile. I'm subscribing to the events in an editor script on enable (I unsubscribe, then subscribe as not to have duplicate subscriptions. I'm Googling and it appears a couple of others have had similar issues, but I haven't seem to find a solution yet. :(

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Ok then it's a common problem of Unity... Re-Serialization, which occurs on recompilation, always wipes out unserializable data. This means delegates are usually unsubscribed, too.
There are really very few things you can do against it unfortunately due to the lack of serialization callbacks in Unity 😠

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

Uh oh:

"This is a bug in 5.3.4p4+. It's not fixed yet (as of 5.3.5p2)."

Looks like it might be a Unity bug like you said:
http://forum.unity3d.com/threads/any-error-in-code-any-makes-all-custom-editor-scripts-disappear.408124/

I'm going to try and jump back to before 5.3.4.

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

I mean I developed a solution for serializable delegates but still these callbacks are stored as static variables in NodeEditorCallbackReceiver and thus have no chance of being properly serialized and restored...
So the easiest fix would be on your side to recurrently resubscribe (dirty but I have currently few other ideas)

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

It's not straight a Unity bug, serialization is a normal process. Just unitys fault for not providing a good interface/API to handle this 😠
But where does it say above sentence?
It has always been a problem with Unity:/

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

Forgive my lack of understanding, but what exactly do you mean by recurrently resubscribe?

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

I thought of doing the process of unsubscribing and resubscribing in Update so you can be sure it is subscribed. It's dirty but my brain's currently too tired to do better:P

Because the initial problem you got is that when a re-serialization is performed, your subscriptions are wiped. So this would make sure it is always subscribed, and always only one instance:)

from node_editor_framework.

snarlynarwhal avatar snarlynarwhal commented on June 21, 2024

So I ended up making a class that extended NodeEditorCallbackReceiver and it's working SOO much better for me lol. No weird delegate issues, no editor scripts randomly not working, no DestroyImmediate issues...

New question: Any way to deleted Canvases saved to the scene? It's bugging me have old debug canvases just sitting there lol.

from node_editor_framework.

Votrubec avatar Votrubec commented on June 21, 2024

My next task was to include the Delete option for assets saved to the Scene. I've got leftover scene assets littering the scene. I was also thinking of saving the nodes themselves to .asset files as well. Interested in hearing progress anyone makes with this if I don't get around to sorting out first.


From: PJ Legendre <[email protected]mailto:[email protected]>
Sent: Wednesday, July 6, 2016 10:03 AM
Subject: Re: [Baste-RainGames/Node_Editor] Can no longer save to the scene or load from the scene (get errors) (#82)
To: Baste-RainGames/Node_Editor <[email protected]mailto:[email protected]>

So I ended up making a class that extended NodeEditorCallbackReceiver and it's working SOO much better for me lol. No weird delegate issues, no editor scripts randomly not working, no DestroyImmediate issues...

New question: Any way to deleted Canvases saved to the scene? It's bugging me have old debug canvases just sitting there lol.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/82#issuecomment-230637790, or mute the threadhttps://github.com/notifications/unsubscribe/AGl2CA2LpnuKtJzXCu4-DMRTk3zn2Q9-ks5qSvDFgaJpZM4JFN_o.

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

@pi3butcher Good solution, if thats possible for you :)

Yes I haven't implemented a GUI option for this. It's theoretially easy, there is a save object holding all canvases as components... simply delete the component (by code, as it's invisible, or change hideFlags).
But initially I planned to completely reorder the GUI to fit into a toolbar at the top, so you'd have dropdowns of 'File/' to save/load, 'Edit/' with clutter and options, etc. :D
I delayed it until it would be implemented but yet found not much time to do so, because I also have other bugs to check and fix... I'll have holidays next week so it'll get better for me to work on this:)

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

@Votrubec If you'dbe willing to implement it (not necessarily with the whole GUI but would be easie in the long run) that'd be great:)
But what do you mean with 'saving nodes themselves to .asset files as well'? You can't make these assets if the nodes are in a scene file... Why would you want to do this?

from node_editor_framework.

Votrubec avatar Votrubec commented on June 21, 2024

I'll certainly have a crack at doing it properly. As for the "why?"... I recently implemented an Inventory system that used one Scriptable Object to store a List<> of Items. And each Item was it's own Scriptable Object. These were saved to the file system as individual files, just as the Canvas can be saved to its own asset and the Last Session canvas is stored as its own asset file.

Taking this further, I wanted the option to store the Nodes themselves as individual asset files. It just felt a little "safer" to me, and version control just picks up the asset files so there's no extra work needed there. The Item Scriptable Objects were easy to tweak individually if needed, without going through the custom editor window.

I have a very visual designer colleague who has filled the Scene with test canvases until he got used to saving the Canvas to File instead of to the Scene. At the moment, there was no way for him to delete these discarded canvases. I updated the Node and created the custom ConnectionType to allow the designer to add and remove "evolution paths" and the number of paths from each Node without him having to touch any code (and yes, the Node size grows and shrinks correctly with the number of Output Knobs ;) ). From that point, I was wanting him to be able to grab any Node .asset file of his choosing from the Project Window and drop it into the Inspector fields I set up for individual Nodes. And there you have it, Robert's your mother's brother, or Bob's you uncle, either way, the visual designer can design away to his hearts content.

After all of that, I was wanting to take a look at the zooming feature. It seems that sometimes the Node content get's stuck in an incorrect zoom state, so the content sometimes looks like it's a smaller size, but zoomed and blurred to be the current size. The image shows the problem if you look REALLY closely. The Nodes on the left of the Canvas, in particular the wording "Previous" is blurred. The Nodes on the right of the Canvas, the content is crisp and not zoomed.

nodeeditor

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Sorry for the late reply, just came back from a horrible trip from the new forums, need some rest to cool down 😞

If you want to have control over the nodes, it's not too hard. First of, they are already technically stored as single assets, just as (hidden) subassets. If you go into NodeEditorSaveManager.cs you see in the apropriate functions that

  1. All elements (nodes, knobs) that are scriptableObjects and need to be saved are flagged with Hide (look out for Hideflags)
  2. They are saved by attaching to the main canvas (AddObjectToAsset).
    I recommend you to first comment out the lines of 1.) to get an idea of what's happening and then you can modify the behaviour of 2.) so it's saved alongside the asset rather than as a subasset. It's not too hard given you're a bit familar with AssetDatabase, if you need help, I might be able to provide a sample:)
    Similar goes for the scene saving, theres the FetchSceneSaveHolder method at the top in NodeEditorSaveManager.cs. In it you see the same line of 1.) above where the scene save holder is hidden. Instead of commenting clear the hideflags to make sure the object is made visible again in your existing scenes. Similar for asset saving, a re-save is required to make subassets visible:)

Regarding the zooming glitch, that's a known problem but is out of our reach. It's related to Unity's crappy implementation of zooming support (which also required a hell lot of extra hacking work to do to get it properly working, see GUIScaleUtility):/

from node_editor_framework.

Seneral avatar Seneral commented on June 21, 2024

Any updates on this? Don't hesitate to reopen, but I'll just close for now:)

from node_editor_framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.