TextNode doesn't update with C#-Script

Please report bugs in this group. We will maybe populate a list of known bugs with a possibly modified description at a later time.

Moderator: Support

Post Reply
joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

TextNode doesn't update with C#-Script

Post by joschy » 26 Apr 2014, 22:06

Hello,
i have a touch keyboard and with a C#-script and i use the unicode to identify the letters etc., works fine. I use string-varibles as output and in the property editor everything looks fine.
But when i connect this outputs to a TextNode, the TextNode doesn't update his output. If you switch, for example the Kernel flag on/off it updates.
You can see in the property editor that the incoming string is correct, but not the output.
The same with the ValueSwitch. You have to switch between the case to update the output.

greetings, joschy
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: TextNode doesn't update with C#-Script

Post by joschy » 26 Apr 2014, 23:06

... and other funny things:
Image

the TextNode:
Image
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: TextNode doesn't update with C#-Script

Post by joschy » 26 Apr 2014, 23:07

Email.png
Email.png (19.04 KiB) Viewed 4215 times
TextNode.png
TextNode.png (10.85 KiB) Viewed 4215 times
3DJo - [Ventuz] freelancer and trainer


joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: TextNode doesn't update with C#-Script

Post by joschy » 28 Apr 2014, 10:05

Hi Karol,
yes, i did. The C#-Script-Node seems not the problem, it works fine ;). I can see it in the property editor, it does what it should be to do. The problem i've got in to is, that the output bindings, which values are correct, are not updated correct in the TextNodes. The TextNodes are in different HierachyContainers, but i have the same if i connect a TextNode directly to the Output of the C#-Node.
The same with a different C#-Script which mange some int's, the output is a single int. The C#-Script forks fine, but when i plug the output to a int-expression, the expression don't work correct. My workaround, i use the output from the C#-Script ( the single int) as a event argument which reset a counter with argument-option on. That's work...

greetings,
joschy

Btw, the switched "@" in the pics was gone after a restart of ventuz.
3DJo - [Ventuz] freelancer and trainer

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: TextNode doesn't update with C#-Script

Post by joschy » 28 Apr 2014, 10:11

... that's the expression, where the direct connection off the C#-Script doesn't work:
((A <= 9) && (A >= 1)) ? 1 : 0

But with the trick, the output to use as a Event-Argument, it works...
3DJo - [Ventuz] freelancer and trainer

User avatar
Karol
Posts: 605
Joined: 10 Jan 2012, 12:07

Re: TextNode doesn't update with C#-Script

Post by Karol » 28 Apr 2014, 10:13

So if the 'changed' property in your Script is updated correctly on property changes, I have no other ideas what could be going on.
You would have to post the part of your scene with the Script node and we could take a look inside.
If you don't want to share it with the public, you can send me a PM.

Cheers
Karol

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: TextNode doesn't update with C#-Script

Post by joschy » 28 Apr 2014, 10:31

done
3DJo - [Ventuz] freelancer and trainer

User avatar
Karol
Posts: 605
Joined: 10 Jan 2012, 12:07

Re: TextNode doesn't update with C#-Script

Post by Karol » 28 Apr 2014, 12:10

Two problem in your Script:

1. Your Generate() method must look like this: your code never returned true!!!

Code: Select all

	public override bool Generate()
	{
		if (changed)
		{			
			changed = false;
			if (UNICODE_IN > 1) 
			{
				result = Convert.ToChar(UNICODE_IN);
				SingleSign = Convert.ToString(result);
			
				switch (TabSelect)
				{
					case 1:
						Name = string.Concat(Name, SingleSign);
						UpdateName();
						break;
					case 2:
						UpdateFirma();
						Firma = string.Concat(Firma, SingleSign);
						break;
					case 3:
						UpdateEMail();
						EMail = string.Concat(EMail, SingleSign);
						break;
				}
			}
				
			//O_String = string.Concat(O_String, SingleSign);
			return true;
		}
		
		return false;
	}
2. All of your EventHandler Methods (On...()) must set 'changed = true' as they change the outputs:

Code: Select all

	public bool OnDot_COM(int arg)
	{
		EMail = string.Concat(EMail, ".com");
		changed = true;
		return false;
	}
You should read the Scripting section in the help very carefully as scripting involves some pitfalls :)

Best Regards
Karol

joschy
Posts: 142
Joined: 19 Jan 2012, 07:39
Location: Düsseldorf, Germany
Contact:

Re: TextNode doesn't update with C#-Script

Post by joschy » 28 Apr 2014, 14:29

Damned... shame on me :oops:
Yea, the "changed = true" thing is a pitfall, after this experience i hope it is burned in my brain...

Sorry for the circumstances,
joschy
3DJo - [Ventuz] freelancer and trainer

Post Reply