Jump to content

[SOLVED] Refresh all NodeReferences when node has changed


photo

Recommended Posts

Hello

 

I have a problem with the following:

 

I create a NodeReference which is pointing to a SoundSource saved as node-file. We clone this NodeReference multiple times and place them in the world.

 

 

One of these references is called trough a WorldExpression and added to normal script code:

#ifndef ENVIRONEMNT_EXP
#define ENVIRONEMNT_EXP

#include <unigine.h>

int initDone;

void main()
{
    if(!initDone)
    {
        Node node = node_cast(getNode());
        Node child = node_cast(node.getChild(0));

        engine.world.call("Client::World::ExpressionManager::addNode", child);

        initDone = 1;
    }
}

main();

#endif // ENVIRONEMNT_EXP

void addNode(NodeReference _node)
{
                // Add to map
                nodes.append(node_cast(_node.getNode()));
}

After that I do some adjustments to the gain:

SoundSource(node).setGain(0.0f);

Now the SoundSource is has the 0.0f gain but all other NodeReferences pointing to the same node are still have the old gain value (in this case 1.0f).

If I manipulating a NodeReference with "Edit" in the editor all other NodeReferences are updated.

 

I tried to understand the editor sources but didn't find what I exactly have to call to update all the other NodeReferences (They should too get 0.0f as gain value).

 

Thanks!

Link to comment

Hi,

 

If you just want to turn off sound you can organize node hierarchy with dummy node as root and disable root node. Otherwise, you should set required parameters to the each NodeReference individually, sorry.

 

I tried to understand the editor sources but didn't find what I exactly have to call to update all the other NodeReferences (They should too get 0.0f as gain value).

Please, check the data/core/editor/editor_reference.h file (apply_clicked function).

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...