Solved Nodes and attributes of GvOperatorData plugin

Hello,

I'm writing an XPresso node, deriving its class from GvOperatorData.

The node's .res file looks a bit like this:

CONTAINER mynode
{
	NAME mynode;
	INCLUDE GVbase;

	GROUP ID_GVPROPERTIES
	{
		REAL MYNODE_ATTRIBUTE_1 { };
		BOOL MYNODE_ATTRIBUTE_2 {  }
	}

	GROUP ID_GVPORTS
	{
		REAL INPORT_X { INPORT; NEEDCONNECTION; STATICPORT; CREATEPORT; }
		REAL INPORT_SOMEVALUE { INPORT; EDITPORT; UNIT PERCENT; MIN 0.0; STEP 0.1; }
		REAL OUTPORT_VALUE { OUTPORT; STATICPORT; CREATEPORT; }
	}
}

In the code, in Bool MyNode::Calculate(), I do the following to get the values:

	if (!GvCalculateInValuesTable(bn, run, calc, _ports))
		return false;

	BaseContainer* dataPtr = bn->GetOpContainerInstance();
	if (!dataPtr)
		return false;

	if (port && port->GetMainID() == OUTPORT_VALUE)
	{
		// Get a value from a port
		GvPort* const portInputValue = _ports.in_values[0]->GetPort();
		Float inputValue = 0.0;
		if (portInputValue)
		{
			if (!portInputValue->GetFloat(&inputValue, run))
				return false;
		}

		const Float someFloatValue = dataPtr->GetFloat(MYNODE_ATTRIBUTE_2);
		const Bool someBoolValue = dataPtr->GetBool(MYNODE_ATTRIBUTE_2);
	}

Getting the values works fine: When getting the value of a port, I'll get either the value that comes on from a connection in the node network, or I'll get the value from the Attribute Manager, if the port is not connected.

Question
However, the entry does not disappear from the Attribute Manager once I connect the port. In the builtin XPresso nodes, ports' attribute entry will vanish from the AM when the port is connected. How can I achieve that?

By the way, full code is here:
https://github.com/fwilleke80/Oscillator/blob/master/source/node/gvoscillator.cpp

Thanks in advance & best greetings,
Frank

www.frankwilleke.de
Only asking personal code questions here.

hi @fwilleke80,
thanks for providing the code, it helped to see where the problem was :)
You need to call the SUPER at the beginning (and not when returnning).
And you don't need to load the description as you did with

if (!description->LoadDescription(ID_OSCILLATORNODE))
		return false;

This code should work.

	virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags)
	{
	
		if (!SUPER::GetDDescription(node, description, flags))
			return false;
		flags& DESCFLAGS_DESC::LOADED;
		
		
		return true;
	}

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Hi Manuel,

oh right, that does the trick! Thank you, one bug less! :-)

Cheers,
Frank

www.frankwilleke.de
Only asking personal code questions here.