dynamically using xpresso node in python



  • On 24/12/2015 at 10:37, xxxxxxxx wrote:

    Hi All,

    I have setup a simple scene using thinking particles and the PLight node. Everything works fine as long as I'm using only one light source. Is there any way to use the PLight node and feed in the influence of multiple light sources (number of lights grows dynamically) ?

    Is it possible to combine multiple light sources (like BOOLE or CONNECT object) in order to plug in the resulting light into the light input port of the PLight node ?

    Or can I accomplish this using a python node ? :

    Lets take this example (P Pass outputs 10 particles) :

    P Pass --> (Particle) PGetData (Position) --> (Position) PLight

    Each frame the position of particles 0-9 will be sent in the PLight node checking for the brightness at these positions. In the working scenario only one light is plugged in the PLight node.

    Now lets assume more light sources are generated during the animation all grouped under a null object.

    Is there any way to setup a python node to get this workflow : Each frame all 10 particle positions should first be sent in the PLight node checking light souce 1 and then (before stepping to the next frame) all 10 positions again checking light source 2 and so on ... ?

    If neither combining several lights to one resulting light nor alternating several lights on the input port of the PLight node is possible - is there any way to get similar PLight functionality by using ONLY python code (without any Xpresso) ?

    Thanks



  • On 04/01/2016 at 03:28, xxxxxxxx wrote:

    Hello,

    I'm not an Xpresso or TP expert so may not be able to help much. There are an Hierarchy and an Iteration node that might be used to iterate through the child objects of a parent object but I don't know if this might be combined with your case or not.

    Xpresso Python nodes are made for mathematical and local operations. So you could iterate through the child objects of a given object and calculate the sum of these operations in that node. To apply this result to a particle, you should use an output variable and a PSetData node.

    Best wishes,
    Sebastian


Log in to reply