Coder Social home page Coder Social logo

Comments (10)

Seneral avatar Seneral commented on June 12, 2024

No, that is definitely not intended behaviour - it's been a while though since I implemented it, so I'll have to take a look tomorrow. Thanks for reporting

from node_editor_framework.

Seneral avatar Seneral commented on June 12, 2024

FYI here is the relevant implementation

from node_editor_framework.

JMFrancia avatar JMFrancia commented on June 12, 2024

Thank you very much, I'm taking a look into it as well.

The main thing I'm confronting is that my nodes have several drop-down menus in the form of either enums (using RTEditorGUI.EnumPopup(Enum val)) or strings (using RTEditorGUI.Popup(string[], index). I'll set these drop downs to some value or another, export to XML, re-import and the values will not have been saved.

Based on the implementation of ReflectionUtility.getSerializedFields() I thought perhaps the issue was that I was not marking the popup index vals as serialized. However I just ran a test by marking those values as serialized before exporting and it doesn't seem to make a difference.

from node_editor_framework.

JMFrancia avatar JMFrancia commented on June 12, 2024

Found the issue. On the XML export process, obj.GetType().GetField(fieldName) is failing to find every field that is NOT a string. It fails to find int field, fails to find bool field, fails to find enum field: https://github.com/Seneral/Node_Editor_Framework/blob/develop/Node_Editor/Default/IO%20Formats/XMLImportExport.cs#L308

from node_editor_framework.

Seneral avatar Seneral commented on June 12, 2024

Ok so just tested myself on windows, Unity 2017.4.24f1 and it works fine. If you can tell me your version I'll test that as well, might be some changes broke things. Am I right to assume that the coded warning popped up or an error?
Edit: Found a bug where it would fail to find the variable when it's private but with [SerializeField] - XML-IO assumes all serializable variables to be public. Could that be related, although you also said it failed in the default example?

from node_editor_framework.

JMFrancia avatar JMFrancia commented on June 12, 2024

I was just coming here to mention that if I make the fields public it works correctly. I was surprised to find that [SerializeField] did not have the same effect. I also tried passing BindingsFlags.NonPublic but that did not help either. Only using Public has worked so far.

And yes, I also saw the fields not saving in the calc. graph. I'm using 2019.1.13f1

from node_editor_framework.

Seneral avatar Seneral commented on June 12, 2024

Just noticed it isn't even meant to refetch the variable value at all - that is done during creation of the structured data beforehand. So just change this to:

else // Serialize value-type fields in-line
{
	XmlElement serializedValue = SerializeObjectToXML(node, varData.value);
	serializedValue.SetAttribute("name", varData.name);
}

That should work (only for export, error will still appear on import) - although I'm still not sure what causes the error for you on the default nodes... Maybe they made the BindingFlags necessarily explicit on newer versions? Not really up to date with unity versions anymore unfortunately

from node_editor_framework.

Seneral avatar Seneral commented on June 12, 2024

With 1bbb287 private [SerializeField] fields work for me now. Can you check if that fixes your issue with the CaluclationCanvas as well?
Will check in 2019 now

from node_editor_framework.

Seneral avatar Seneral commented on June 12, 2024

Ok finally got around to try in 2019.1. I'm still not getting the field not found error on line 308 - but a serialization error in line 363. Seems the way XMLSerializer works changed with Net 4.x, it will now always call a method that will throw an error even though it knows it would throw an error...
Workaround added in 19f0059
Does that fix it for you now? Works fine for me in 2019.1 now

from node_editor_framework.

JMFrancia avatar JMFrancia commented on June 12, 2024

That solved it! Excellent work. Thank you for being so responsive.

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.