Jump back into Switcher and lay down a container COMP called Selector_A.
Set Output Resolution to 640 x 360, set Node View to Default Viewer and give it ./out_A as Background TOP.
Jump inside and create a typical render setup: Camera COMP, Light COMP, Geometry COMP and Render TOP.
Jump into the geo1 COMP, delete the default torus and create a Rectangle SOP.
Set sizex = 1 and sizey = me.par.sizex * 9 / 16 – Remember to turn Display and Render Flags on.
Set Render TOP to 640×360. Add a Constant MAT and give it to the geo COMPs Material parameter.
Connect the Render TOP to an Out TOP. Rename it to Out_A.
Lay down a GridSOP, sizex = 4 , sizey = me.par.sizex*9/16 with 4 Rows and 4 Columns.
Connect it to a Sopto CHOP, a Merge CHOP and a Null CHOP.
Rename the Null CHOP to Instancer. Add a Pattern CHOP, Type Ramp with Length 16, Amplitude of 2, set Channel Name to tex and set the To Range to 1 to 16 (16 discreet values).
If you make the node viewer active , right click and select Dot per Sample, you get a better feel for what we are doing.
Now wire the pattern output into the Merge CHOP. We have used the Grid SOP to define 16 distinct points in space. We added a rising number to each of these points through the Pattern CHOP. Now we can use these channels to place objects onto that coordinates. Go to the geo1 node and turn Instancing on. Drag the Null CHOP called Instancer onto the Instance CHOP/DAT field. Now you can use the channels tx, ty and tz for the TX, TY and TZ parameters.
On the Instance 2 page you can use tex for the Texture Index Parameter. In the Instance Textures field write:
/project1/source_[1-16]/text[1-16]
This means, that for each of the 16 instances there is a texture with the number tex in name
on the top level of the project, inside the source_ [1-16] containers. If your render still doesnt show anything, move the light and the camera to a higher z position. In my case 6.1 for the camera and 5 for the light work well.
Adjust the size of grid1 SOP and rectangle1 SOP (lives inside geo1 COMP) to spread the instances more even. For me sizex = 3.75 for grid1 SOP and sizex = 1.2 for rectangle1 look allright. The respective sizey is automaticall kept in a 16/9 aspect through the expressions.
Next we want to make the preview tiles clickable so that we can select sources that way. Back into Selector_A we lay down a Panel CHOP and in the Select field we write u v select. That way we learn the position and select state of the mouse that navigates the container in which the Panel CHOP lives.
Feed that to a Chopto DAT (turn Include Names on) and to a Renderpick DAT. Set Strategy to Hold First Picked, Pick Radius to 3, Render TOP to render1 and on the Options page set Fetch Position to In Camera Space and turn on Fetch Instance ID.
Continue with a Select DAT, Set Select Rows to by Index, Start and End Row Index to 1 and set Select Cols to By Name. Set Start and End Col Name to Instance. That way we only get one number:
The ID of the tile that has been clicked.
With a Datto CHOP we fetch that data into the CHOP world, set Output to Channel per Column and First Row is to values. Next we send this into a Rename CHOP and rename it to sourcea. Next we add a Null CHOP, set the Cook Type to Selective and turn Check Values, Check Names and Check Range on. That means this Null will only cook when there is actually some change in the values.
This makes our patch faster.
Now we lay down an Out CHOP and feed sourcea into it. We will use it later. We also run it into a Fan CHOP with the Channel Names set to chan[1-16] and Outside Range set to Set Channels to 0.
From here we go into a Shuffle CHOP, Method set to Swap Channels and Samples.
Now add a Filter CHOP and turn Filter per Sample on. Add again a selective Null CHOP, to contain cooking. From here split the signal up through two Math CHOPs The first has the Range 1 to 0.75. We will use this to scale down the selected instance. The second one gets a Range from 0.75 to 1.5. We will use this one to highlight the selected tile. Rename the first channel to select and the second to hilite.
Feed them into the Merge CHOP. Now the new values are available to be used on the instances.
On the Instance page of the geo1 node, set the Parameters SX and SY to select.
On the Instance 2 page, set the A parameter to hilite.
If you zoom out of the container and turn it active, you can now select preview tiles by clicking them. Connect Null operators to the containers outlets to see what is coming out of them.
Lets take sourcea and use it to drive switch_A and turn Blend between Inputs on.
Now the switch should output the source that you clicked on.
Copy Selector_A and the Null coming from it, paste and rename to Selector_B. Jump inside, navigate to rename1 CHOP and change it to sourceb. Use sourceb to drive switch_B.