Skip to main content

Node2D Plugin

Answered

Comments

9 comments

  • Official comment
    Jason


    There are a few different ways that you can get the Node 2d plugin working in your own project. 
    1) Project Import
    Import in the assets you need from the example Node 2d project, and reuse the assets as you require. This can include the node2d plugin itself. This will duplicate the assets from the node 2d project, and import those duplicates to your project. 

    2) Project Merge
    Instead of Importing in the assets, you can Merge the node 2d example project to your current project. This will create a live connection from the node 2D assets, and to the assets that exist in your project. Any update to the original assets, will also be reflected in your project. 

    3) Importing Plugin
    The last way to do get the Node 2D plugin is to locate it on your hard drive and import it into your project and reset up all the assets and functionality that you are looking for. This is the recommended way of working, as this allows you full customization, and does not import unnecessary assets to your project, but this workflow requires you to configure the bindings, and triggers to your project and assets. 

  • Mason

    I have tried importing the plugin manually into an existing project which allows me to create a Video View 2D node, however once I create a Video View 2D node, the following error occurs:
    Preview Application has terminated unexpectedly:
    Abort signal, Preview will be terminated!

    Then if I try to start the preview I get the following:
    Preview Application has terminated unexpectedly:
    Failed to acquire resource 'kzb://node2d_plugin/Brushes/VideoViewBrush' (code -10401)

    I do notice that in the example project there are many different materials and such that are related to videos that don't seem to exist when just importing the Node 2D plugin to an existing project. How would I proceed here?

    I have also tested using a video that is 5040x216 in the example project and I was met with the same error which terminates the preview. This came along with the following in the logs:

    04:03:03 PM Fragment shader failed to compile: PixmapTexturedVideo
    04:03:03 PM Application WARNING: ERROR: 0:3: '#extension' :  'GL_OES_EGL_image_external' is not supported
    ERROR: 0:4: 'ContentTexture' : syntax error syntax error


    04:03:03 PM Application WARNING: Failed to open video file

    If you could let me know how to proceed with importing the plugin and any associated materials/etc, that would be great. And if you know what could be causing the second issue as well.

    Thanks!

    0
  • Jason

    Hi Yes, 
    The reason you are seeing the following error;
    Preview Application has terminated unexpectedly:
    Failed to acquire resource 'kzb://node2d_plugin/Brushes/VideoViewBrush' (code -10401)
    is because the Node2D plugin is expecting the brush to be at that location, and it isnt inside your own project. In the URL //node2d_plugin/ is the project name, and the plugin is hardcoded to look in that directory. 

    There are 2 options you can do. 
    Option 1, go into the source code of the Node2d plugin, and modify this for your own project location. 
    Option 2, import a reference .kzb to your project. 

    Option 2 is as simple as going into the original example project and exporting the .kzb of the project. Then going to your own custom project and in your Library right click Project References>>Create>>Existing .KZB and select the .kzb you exported from the node2d_plugin project. 
    This should solve your issue easily and quickly 

    0
  • Mason

    That looks like it solved that issue, but I am now receiving the following error:

    03:56:25 PM Application INFO: Loading plugin 'Node2D_plugin.dll'
    03:56:25 PM Application WARNING: Surface Color Space/Color Workflow mismatch while loading kzb file (node2d_plugin). Please update the Color Workflow property within the project, or change the surface color space used in the application configuration.
    03:56:26 PM Application INFO: Loading plugin 'kzshapes.dll'
    03:56:26 PM Application INFO: Loading plugin 'DatalinkDatasource.dll'
    03:56:26 PM Application INFO: Loading Kanzi UI Automation plugin: 'kzuiautomation_GL_vs2019_Release.dll'
    03:56:30 PM Application WARNING: Failed to open video file

    I assume it has to do with folder structure possibly, but I am unsure. Is there a way to direct the plugin to look at a specific directory for the video file? (assuming this is the issue)

    Thanks again for the help!

    0
  • Jason

    Yes you are correct, the video is expected to be in a specific folder location, and if it doesnt exist there then the plugin will cause this error. 

    You will need to modify the source code of the node 2d plugin to ensure correct functionality and to load the video from your desired location. 

    0
  • Mason

    I took a quick look through to see if I could find where I might need to modify this, but I haven't found anything that stands out as a directory path or anything for the vide files. Would you happen to know this and if so, could you point me in the right direction?

    Thanks

    0
  • Jason


    Kanzi uses the application/bin folder as the central resource location of assets used for the project. It is recommended to use this reference for your resources, but it may be required to change this location for production projects. Instead of using the domain pointer, you can create a string to a file location and use this instead. There may also be better solutions if you are more familiar with C++.

    The bin folder is additionally where the .kzbs will be built to along with any config files required for when you deploy to a target platform. This is done to keep all crucial assets in one location.

    You can reference the Kanzi API here:
    https://docs.kanzi.com/3.9.1/en/reference/kanzi-runtime-api/a05777.html

    The plugin will by default look into this location for the video files.
    You can change the name of the video file, or load different ones, by modifying the “Video filename” property that exists at the bottom of your VideoView2D.

    If you additionally want to remove the need for the node2D .kzb loaded as a project reference you can modify the code in “video_view2d.cpp".
    (lines103-106)

    #ifdef ANDROID
        foregroundBrush = acquireResource<Brush>(ResourceID("kzb://node2d_plugin/Brushes/VideoViewBrushAndroid"));
    #else
        foregroundBrush = acquireResource<Brush>(ResourceID("kzb://node2d_plugin/Brushes/VideoViewBrush"));

     

    0
  • Jackson, Oliver

    Hi Jason, is there a linux implementation for this plugin or is this something we'd have to complete ourselves?

    0
  • Jason

    As you have noticed, the Node2D example only implements video decoders for Windows and Android so making it work on Linux will require a video decoder implemented for Linux. You should be able to follow the same logic where the decoder class provides a texture like Windows and Android implementations and the rest of the plugin should be reusable as it is.

    0

Please sign in to leave a comment.