Forum: Poser - OFFICIAL


Subject: A Compendium of PZ2 Techniques.

lesbentley opened this issue on Mar 31, 2008 ยท 137 posts


lesbentley posted Mon, 12 May 2008 at 6:22 PM

**Disable Slaving.**This may be a bit of an obscure topic, but someone may find a use for it.

Sometimes you may want to disable slaving for some particular channel. In the slaving code the value in the 'deltaAddDelta' line determines the strength of the slaving, so setting this value to zero effectively turns the slaving off. We can do this if there is only one block of slaving code in the channel, or if the block of slaving code that we want to disable is the last block in the channel.

Method A:

{
version
        {
        number 4.03
        }
actor hip
        {
        channels
                {
                targetGeom heroineHip
                        {
                        deltaAddDelta 0.000000
                        }
                }
        }
}

The above pz2 file will set the 'deltaAddDelta' value to zero for the last slaving code block in the channel, thus effectively disabling the slaving. If the channel is only slaved to one master, all is fine and dandy, but sometimes a channel may have more than one master. When the channel has more than one master, and the slaving that we want to disable is NOT in the last block of slaving code, we need to find another trick. If we can find an unused channel to subvert to our purpose, we can do it like this.

Say for example we have a morph channel in the head that uses the dial name "MyMorph", which is slaved to a FBM in the BODY which also uses the dial name "MyMorph", both these channels use the internal name "PBMCC_01".

Say we have a spar channel in the BODY with the internal name of "PBMCC_07". Here is the pz2 we could use to disable the slaving.

Method B:

{

version
        {
        number 4.03
        }

actor BODY
        {
        channels
                {

# Slave the PBMCC_07 channel to the MyMorph dial name (PBMCC_01), using 'valueOpMinus'.

                valueParm PBMCC_07
                        {
                        name <span style="color:rgb(255,0,0);">-MyMorph</span>
                        initValue 0
                        hidden <span style="color:rgb(255,0,0);">1</span>
                        forceLimits 0
                        min -100000
                        max 100000
                        trackingScale 0.004
                        keys
                                {
                                static  0
                                k  0  0
                                }
                        interpStyleLocked 0
                        <span style="color:rgb(255,0,0);">valueOpMinus</span>
                                Figure
                                BODY
                                <span style="color:rgb(255,0,0);">MyMorph</span>
                        }
                }
        }

actor head
        {
        channels
                {

# Slave the PBMCC_01 in the head to the dial name "-MyMorph" (PBMCC_07) in the BODY.
# The deltaAddDelta value needs to be the same as that which you are trying to cancel out (MyMorph).

                targetGeom PBMCC_01
                        {
                        valueOpDeltaAdd
                                Figure
                                BODY
                                <span style="color:rgb(255,0,0);">-MyMorph</span>
                        deltaAddDelta   1.000
                        }
                }
        }
}

The morph in the head (or where ever) is slaved to two valueParm channels in the BODY. Because the value in "-MyMorph" channel is the exact inverse of the value in the "MyMorph" channel (in the BODY), and the same deltaAddDelta value has been used in both slaving blocks in the head, the tow sets of slaving cancel each other out. To finish up, here is a way to temporarily disable all slaving for a channel, even future slaving that has not yet been applied. One nice feature of this method is that it gives you a dial that allows you to turn the slaving on or off.

Method C:

{

version
        {
        number 4.03
        }

actor BODY
        {
        channels
                {

# First we set up the master valueParm channel the way we want it.

                valueParm PBMCC_07
                        {
                        name <span style="color:rgb(255,0,0);">On-Off</span>
                        initValue 0
                        hidden 0
                        forceLimits <span style="color:rgb(255,0,0);">1</span>
                        min <span style="color:rgb(255,0,0);">0</span>
                        max <span style="color:rgb(255,0,0);">1</span>

                        trackingScale <span style="color:rgb(255,0,0);">1</span>
                        keys
                                {
                                static  0
                                k  0  0
                                }
                        interpStyleLocked 0
                        }
                }
        }

actor head
        {
        channels
                {

# Now we slave the channel who's slaving we want to disable to the
# master channel, using 'valueOpTimes'.

                targetGeom PBMCC_01
                        {
                        <span style="color:rgb(255,0,0);">valueOpTimes</span>
                                Figure
                                BODY
                                <span style="color:rgb(255,0,0);">On-Off</span>
                        }
                }
        }
}

NOTES:
What the 'valueOpTimes' operator does it to multiply the 'k' line value in the slave channel by the 'k' line value in the master channel. When the value in the master channel is zero, the slave channel will always be at an effective value of zero, irrespective of what value is set on its own dial, or of any slaving it has to any other other master channels. When the master channel is set at a value of one, the full effect of its own dial, and any other channels it is slaved to will be seen. In this case the "On-Off" channel has been limited to the value of either 1 or 0 by the use of 'forceLimits 1', 'min' and 'max' and the 'trackingScale'. Besides the normal 'valueOpDeltaAdd', and the 'valueOpMinus', and 'valueOpTimes' operators that we have seen in this post, there also exist 'valueOpPlus', 'valueOpDivideBy', and 'valueOpDivideInto' operators. The value operators that use division can cause divide by zero errors, so you should familiarize your self with how they work before experimenting with them.

For in-depth information on ERC, see "How to Write ERC Code" on VK's (a.k.a. atlantis23) site. He has downloadable tutorials on all aspects of ERC. For specific info on the different value operators, see "A different approach to ERC code" on VK's site.

I'll try to come up with something simple and useful for my next post.