Vormav Posted July 1, 2009 Share Posted July 1, 2009 (edited) Hey. Just because I haven't quite thrown enough questions at the group this week, thought I'd put out another. I have a custom VOP network which I'm trying to use to 'wrap' the contained code in a rather non-standard way. Specifically, I want to be able to wrap the code for different child nodes inside different code blocks. At the moment, I have a basic setup that iterates through child nodes connected to my subnet output, calls getCode() on each of these, and then, based on which subnet output they're connected to wraps their code inside different code blocks. This doesn't work, of course. VOP_Node::getCode() only returns the code for the given node, not any of the code for the inputs to that node. I can recursively run through the inputs to each node and get all of the input code as well. But the real problem is that getCode() only returns the code template for the given node (i.e., the code with $-prefixed variables instead of the final generated code). If I wrap all of these templates in the way I need it, the code generator won't be able to resolve any of the variables correctly because it doesn't have the same node inputs/outputs as the child nodes. I could write my own mini code generator for this network, but that's almost more trouble than it's worth. Is there a better way of doing this - maybe something obvious that I've missed? I know that if I make my VOP_Node act as a subnetwork, the sub code gets automatically wrapped inside {} brackets, but that doesn't give me the kind of control I want. What I'm really hoping to do here is mimick SLIM's generative functions, where at any point in the code template you could simply call generate() on one of the node's inputs to get a string containing the code for the given inputs, which you could then wrap however you wanted. So for the VOP_Node, I want something like getCode(), but that'll give me a string with all of the variables already resolved. Edited July 1, 2009 by Vormav Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.