FlowCanvas & NodeCanvas while in Editor Mode?

Forums General Discussion FlowCanvas & NodeCanvas while in Editor Mode?

This topic contains 8 replies, has 2 voices, and was last updated by  Gavalakis 4 months, 2 weeks ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2307

    Enrique
    Participant

    Hello!

    I’m a relatively new user of both of these incredible assets (I’ve had flowscript for a few months but only recently have really tried it out, and decided to complement it with NodeCanvas as I loved how it worked).

    One thing I am really interested in, is being able to utilize such nodes while in Editor Mode. I have used Houdini for Digital Asset Creation for a while but the fact that we can’t really employ the Houdini engine after compiling is a huge annoyance to me. To be fair, most of the times Houdini isn’t something I use for highly specific assets – it is much more of a “quick procedural assets” kinda thing. Because of this, I am convinced I can probably tackle the idea of creating “my own Houdini” as an asset for Unity. Naturally, I’d love to build this from scratch – but FlowCanvas and NodeCanvas seem like a great way to prototype the functionality of such thing.

    Because of this, I am really wondering if we could use these assets “in Execute in Editor Mode”. I read on the Unity forums that this was possible but the post was quite old and I didn’t follow up on it as it said that if anything it would be implemented in the future. Any news on this? It would be amazing to be able to build a “mini Houdini” based on Flow Canvas – whether it gets ported to its own application later is for debate, however I think any Flow Canvas user could easily benefit from such thing.

    Any feedback on the idea and whether this is possible already or how to achieve it would be really appreciated. I am not the best coder but I can certainly do my own things, so I’d gladly tackle the problem myself but I’d like to know whether this functionality is already included or if it’ll be anytime soon.

     

    Thank you so much!

    Wonderful products, ParadoxNotion!

    #2312

    Gavalakis
    Keymaster

    Hello and thank you for your positive feedback! Much appreciated ๐Ÿ™‚

    It used to be possible a long time ago with some (hack) changes, but it is no longer and currently not possible to execute flowscripts in edit-mode. Because FlowCanvas (and NodeCanvas) is essentially built as a runtime visual scripting tool, initialization of the graph (binding ports, instantiating macros, assigning certain references etc) is taking place in runtime only. Some things are taking place in “awake”, while others as soon as the graph is “started”. Furthermore, some nodes (event nodes more specifically) rely on the OnGraphStarted “callback” so that they subscribe to certain game events (and OnGraphStopped for unsubscribe). On the other hand of course, an editor only houdini-like tool for procedural creations does not really need event nodes for example (or most of the things like reflection that are taking place in a flowscript).

    Thus, for such a tool, I think that a brand new type of graph based on the core framework would be a better fit. For this to be possible though, I would need to decouple a few things first so that a completely new type of graph can be created by deriving from FlowGraph. Currently the FlowGraph class implements a few things that FlowScript class is inheriting and using. Those things will need to be moved into FlowScript itself where they belong better, thus leaving only framework related functionality to the FlowGraph class.

    This change is something I do plan to make and when that is done, I think that creating a completely new flowgraph type (even editor-time flowgraph ala houdini) will become far easier, but it remains to be seen of course ๐Ÿ™‚

    If you want to elaborate on anything, please let me know.
    Thank you!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2317

    Enrique
    Participant

    Thank you so much, this is a satisfying answer. I will analyze your code for in hopes of being able to figure this out myself, on the meanwhile I will be looking forward to seeing such update and to see how well I can adjust it to fit this particular need, I’m sure it’ll be much better than anything I’ll be able to do in a few months.

    Very nice products btw, I’m really liking how flowCanvas and nodeCanvas work.

    I do have one more question and that would be:

    How can I access another flowScript from a flowScript dynamically? Let’s say object A has a flowScript that is checking all objects inside of its trigger to determine whether they fit a specific category or not. if they do, I’d like to get a reference to their flowscript but I’d like to set these references at runtime. I messed for a day or two with this but couldn’t figure it out, and I think the documentation available didn’t get me much closer, or at least I didn’t catch it up.

    The documentation is pretty good btw, I’m not trying to say otherwise.

    Thanks!

    #2321

    Gavalakis
    Keymaster

    Hello again,

    Thanks a lot for your positive feedback! ๐Ÿ™‚
    Can you please rephrase your question, or provide a bit more details. I am not sure that I understand exactly what you mean ๐Ÿ™
    Getting a reference to the FlowScriptController component, can in general, be done the same way as it can be done with any component (that is using the GetComponent function node). But I think you mean something different? ๐Ÿ™‚

    Please let me know.
    Thanks again!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2421

    Enrique
    Participant

    Hello Gavalakis!

    I am so sorry I never actually replied to your last post, I never got a notification about it, sorry!

    I will have to look back but that does seem to be exactly what I need, I am just not sure why I struggled to have access to! If I recall correctly, I just couldn’t find a way to utilize GetComponent as a Node – as these references that I am talking about, I want to be able to set them via the FlowScript itself, as opposed to writing a script that has a FlowScript variable. Ultimately, I will have to dig into it and get back at you to let you know if there are any issues, now that you’ve clarified that the system does seem to allow for this.

    Unfortunately, I haven’t been able to play with FlowCanvas (or Unity actually) ever since I created this last post. I am currently getting back into it though, and one thing I would definitely like to know (and please let me know if I should create another subject on the forum for this, as it is not related to the previous question), is how I could put both FlowCanvas and NodeCanvas on their own respective Assembly Definition Files.

    At the moment I have created 2 ASMDEF files for each of Flow Canvas and Node Canvas, one that sits on the root folder of the plugins and one on the Editor folders of each plugin. I have also created a single ASMDEF file for the entire folder ofย  CanvasCore, which sits at its root folder too.

    When I only had NodeCanvas on my project everything worked fine, however as soon as I imported FlowCanvas and created the ASMDEFs files for that specific plugin (The ASMDEF on the root folder and the one on its Editor folder), an issue emerged.

    Unity console displays 22 errors,ย  these are as following (IMG 1):

    There is 2-3 errors pointing out to the cast “string” to “UnityEngine.Texture” not being possible, but most of the errors are pretty much equivalent to the one highlighted on the image above, just different types that cannot be found.

    When examining the lines of code in Visual Studio, I get the following message (IMG 2):

    Sorry about the spanish text, I hadn’t realized my Visual Studio isn’t in English. Ultimately, it’s simply telling me there’s a conflict between the StyleSheet type provided by FlowCanvas and the one provided by my Assembly “CanvasCore – META – PPXAssembly”. However, I think my assembly files are correct! I am not sure why the ambiguity is popping up but since I am no expert at this I am sure I could be very wrong without noticing.

    I will show you how I’ve set up the assembly files in case there’s something obvious that I am missing:

     

    1) ASMDEF on the root folder of NodeCanvas (NCanvas1.png) :

    2) ASMDEF on NodeCanvas’ Editor Folder (NCanvas2.png):

    Aaaand I’m out of space for attachments on this reply so I’ll continue on the next one….

    Attachments:
    You must be logged in to view attached files.
    #2426

    Enrique
    Participant

    3) ASMDEF on FlowCanvas’ root folder (FCanvas1.png):

     

    4) ASMDEF on FlowCanvas’ Editor folder (FCanvas2.png):

     

    5) And ultimately… ASMDEF on CanvasCore’s root folder (CanvasCore.png):

    I would really appreciate some help on this matter as I really want to have all my assets with corresponding ASMDEF files, as otherwise my project takes too long to compile since I have quite a few plugins on it already.

    If there is any issue you can see, or could help me out clarify how to go about doing this, I would really, reaaaally appreciate it.

     

    Once again, thank you so much for being so helpful and I look forward to hearing from you.

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #2431

    Gavalakis
    Keymaster

    Hello again ๐Ÿ™‚

    May I suggest a simpler solution? You can add an asmdef on the root “ParadoxNotion” folder and as such have everything (both NC and FC) in an asmfdef. I don’t see any reason to separate into three different ones really ๐Ÿ™‚
    With that said, the issue you are facing is due to a partial class that lives in NodeCanvas as well as FlowCanvas folder, that being StyleSheet.cs . There is a ‘StyleSheet.FlowCanvas’ in the FlowCanvas folder which is partial to the ‘StyleSheet’ in the NodeCanvas folder. Probably that was a bad idea, but I just fixed that for the next version. In the meantime however, you can either move both StyleSheets files to exist in the same asmdef, or alternatively, simply use one asmdef in the root “ParadoxNotion” folder.

    Let me know if that works for you.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2435

    Enrique
    Participant

    Hey Gavalakis!

    It all worked out perfectly, I did end up moving the class around as you suggested.

    Thanks for the help! I appreciate it!

    #2439

    Gavalakis
    Keymaster

    Great! Thanks for letting me know and you are welcome! ๐Ÿ™‚

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.