Forum: Poser 12


Subject: Rotation when using an HDR bitmap on the background node

Y-Phil opened this issue on May 02, 2021 Β· 13 posts


Y-Phil posted Thu, 13 May 2021 at 10:55 AM

hborre posted at 10:54AM Thu, 13 May 2021 - #4418236

Would it be possible to engage the x- and z- rotations in the script? It might not be practical for everyone but it would be interesting to have additional options.

Here you are: an updated version of the script that lets you enter either the vertical rotation or tuple (x,y,z) of values:

def ask_for_a_string(question):
    ''' 
        Let's enter a string. 
        Note that for numerical values, there is a dedicated function
    '''
    dialog = poser.Dialog()
    txt_dlg = poser.DialogTextEntry(dialog, question)
    return None if not txt_dlg.Show() else txt_dlg.Text()

def set_background_angle(x, y, z):
    bk_shader = poser.Scene().BackgroundShaderTree()

    for node in bk_shader.Nodes():
        if node.Type() == 'ccl_Mapping':
            node.InputByInternalName('Rotation').SetColor(x, y, z)

    bk_shader.UpdatePreview()
  
def get_background_angle():
    bk_shader = poser.Scene().BackgroundShaderTree()
    node = [n for n in bk_shader.Nodes() if n.Type() == 'ccl_Mapping']
    if not node:
        return None, None, None

    return node[0].InputByInternalName('Rotation').Value()
    
msg = "Enter either the Vertical Rotation or x,y,z (rad)"
x,y,z = get_background_angle()
if x != None:
    msg = "{}nActually: {:.5f},{:.5f},{:.5f}".format(msg, x,y,z)

val = ask_for_a_string(msg)
if val != None:
    check = val.split(',')
    if len(check) == 3:
        x, y, z = eval(val)
    else:
        y = float(val)
    set_background_angle(x, y, z)

π’«π’½π“Žπ“


(っ◔◑◔)っ

πŸ‘Ώ Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gaming, Asus Tuf Gaming RTX 4070 OC Edition, 1+2 TB SSD's, 6+4TB HD
πŸ‘Ώ Mac Mini M2, Tahoe 26.5, 16GB, 500GB SSD
πŸ‘Ώ Nas 10TB
πŸ‘Ώ Poser 13 and 14 β€οΈ

π‘€π“Ž π’’π’Άπ“π“π‘’π“‡π“Ž