Armory: Wrong cast in CallFunctionNode

Created on 28 Sep 2020  路  1Comment  路  Source: armory3d/armory

In

https://github.com/armory3d/armory/blob/master/Sources/armory/logicnode/CallFunctionNode.hx

the line

var object: Object = inputs[1].get();

seems to be wrong.

The input 1 is Trait and as we can see in

https://github.com/armory3d/iron/blob/master/Sources/iron/Trait.hx

its not extended from Object or anything. I have no idea why it works in Krom, but when running for example a Windows build it always gives runtime cast exception and crashes the app.

Solution:

var object: iron.Trait = inputs[1].get();

Works in Krom, Windows and Android builds.

_Sorry I wont do a PR :P, short on time._

bug logic nodes

Most helpful comment

Thanks for the report. I think we shouldn't cast the incoming value at all and just set it to Dynamic. This way this node can call arbitrary functions from all kinds of objects (the socket says Trait/Any, maybe we find a better name for that). I won't open a PR right now because I currently can't test the HL/C target because of https://github.com/armory3d/armory/issues/1899#issuecomment-700663548.

>All comments

Thanks for the report. I think we shouldn't cast the incoming value at all and just set it to Dynamic. This way this node can call arbitrary functions from all kinds of objects (the socket says Trait/Any, maybe we find a better name for that). I won't open a PR right now because I currently can't test the HL/C target because of https://github.com/armory3d/armory/issues/1899#issuecomment-700663548.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guzzard picture guzzard  路  4Comments

donalffons picture donalffons  路  4Comments

GrahamWilkins picture GrahamWilkins  路  3Comments

HeadClot picture HeadClot  路  3Comments

Sanva picture Sanva  路  3Comments