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 Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
๐Ÿ‘ฟ Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
๐Ÿ‘ฟ Nas 10TB
๐Ÿ‘ฟ Poser 13 and soon 14 โค๏ธ