Jaanus Posted March 17, 2019 Share Posted March 17, 2019 (edited) Hi, I have quite a specific question. What would be a good and straightforward way to make a grid's divisions and aspect ratio depend on an image I am to use in an Attribute from Map SOP to color it? My aim at the moment is a HDA that let's the user choose an image from the hard drive, adds it's colors to the grid and calculates the divisions of that grid and the aspect ratio of that grid based on the image. Currently it seems to me I have to jump through using either Python, COPs context or VEX shader context, although it seems like something that perhaps is somehow still doable in only SOPs and VEX/VOPs. I don't have nothing against doing it in COPs, shader VOPs or Python, I just haven't thought of a straightforward way to get information from one of these areas to SOPs. Under shader VOPs there is a Resolution node that should give these numbers perhaps in the most straightforward way, and there are the COP specific VEX functions ixres and iyres and inputs in the COP VOP node, but at the moment the way VEX and VOPs work in COPs seems different enough from SOPs that I haven't found out a good way to get these numbers into SOPs. Same problem with using Python node in SOPs. Any ideas on how best to tackle this? Edited March 17, 2019 by Jaanus syntax errors, missing words Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted March 17, 2019 Share Posted March 17, 2019 On a grid-node just right-click in order to switch the expression language to Python and use this: 1 1 Quote Link to comment Share on other sites More sharing options...
Jaanus Posted March 17, 2019 Author Share Posted March 17, 2019 (edited) Thank You! This was a very helpful response indeed. Although the size calculation doesn't work for me for some reason yet, although triple-checked the spelling (will probably give a go at finding a fix myself later), Your solution to my main question indeed was straightworward and a lot more elegant than any route I thought I would have to go through. In addition You gave me some ideas on how to tackle some other problems in the future. Thank You! Edited March 17, 2019 by Jaanus 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.