Page 1 of 1
TextNode doesn't update with C#-Script
Posted: 26 Apr 2014, 22:06
by joschy
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
Re: TextNode doesn't update with C#-Script
Posted: 26 Apr 2014, 23:06
by joschy
... and other funny things:
the TextNode:

Re: TextNode doesn't update with C#-Script
Posted: 26 Apr 2014, 23:07
by joschy

- Email.png (19.04 KiB) Viewed 9495 times

- TextNode.png (10.85 KiB) Viewed 9495 times
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 08:59
by Karol
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 10:05
by joschy
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.
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 10:11
by joschy
... 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...
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 10:13
by Karol
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
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 10:31
by joschy
done
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 12:10
by Karol
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
Re: TextNode doesn't update with C#-Script
Posted: 28 Apr 2014, 14:29
by joschy
Damned... shame on me
Yea, the "changed = true" thing is a pitfall, after this experience i hope it is burned in my brain...
Sorry for the circumstances,
joschy