is it possible to do sth like this in ApexScript:
def test(a: ApexNodeID): b = a.name() return b
or even
def test(a: ApexNodeIDArray): then do something with it like printing all names as string etc for debugging
Cheers and thanks,
Max
def test(a: ApexNodeID): b = a.name() return b
def test(a: ApexNodeIDArray): then do something with it like printing all names as string etc for debugging
def exampleGraph() -> Float: value = Float(__name='value') return value graph = exampleGraph nodeid = apex.graph.findFirstNode(graph=graph, pattern='v*') name = graphutils.nodeName(graph=graph, nodeid=nodeid) BindOutput(name=name, __name='output')
mmassloh_houd
is it possible to do sth like this in ApexScript:...def test(a: ApexNodeID): b = a.name() return b
def test( graph: ApexGraphHandle, node_id: ApexNodeID) -> string : name = "hardcoded_prefix_" name += graph.nodeName( node_id ) return name graph: ApexGraphHandle = BindInput() node_id: ApexNodeID = BindInput() name = test( graph, node_id ) BindOutput( name )
graph.nodeName( node_id )
def printnames(nodes:ApexNodeIDArray, g:ApexGraphHandle) -> String: test = "" for node in nodes: name = node.name() test += "__"+name return test
tamte
ApexGraphHandle. autocomplete doesn't show that function, which makes it very difficult to discover Object oriented syntax, especially since that function is not even in apex.graph, but in apex.graphutils module
tamte
but even functions from apex.graph module don't show up in autocomplete, like the mentioned findFirstNode()
is this a known current autocomplete limitation similar to variables not being to show autocomplete at all?
edwardI don't believe it's the same issue since in APEX script we use type hints quite a lot (if not all the time as it tends to complain if they are not provided, suggesting that APEX Script aims to emulate strongly typed language)
This is hard unfortunately because the types of the variables being completed are not known: The parameter code editor doesn't run any of the code being typed in. This is the same if you did something like "geo = hou.Geometry(); geo.<complete>" in a regular Python SOP. It only works if you're in a Python Shell where we've actually executed "geo = hou.Geometry()".
tamte
I believe the types can be assumed ahead of time in case the hints are clearly provided to aid with helpful autocomplete
tamte
I am in 20.5.487
edwardapex.graph.find
Hmm, I just tried this and it works in my 20.5.491 (just my development builds are updated nightly). I did: "g = apex.graph.find" and the menu that came up included findFirstNode().
tamte
I'm talking about Object oriented access to those function from the type itself
ApexGraphHandle.
or does that run into similar parsing issues as if I wanted to autocomplete from variable with such type as a hint?