def build_gui_add_sine_attr():
    window_name = 'build_gui_add_sine_attr'
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name)
    build_gui_add_sine_attr = cmds.window(window_name, title=(((script_name + '  (v') + script_version) + ')'), titleBar=True, mnb=False, mxb=False, sizeable=True)
    cmds.window(window_name, e=True, s=True, wh=[1, 1])
    content_main = cmds.columnLayout(adj=True)
    title_bgc_color = (0.4, 0.4, 0.4)
    cmds.separator(h=10, style='none')
    cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 10)], p=content_main)
    cmds.rowColumnLayout(nc=3, cw=[(1, 10), (2, 200), (3, 50)], cs=[(1, 10), (2, 0), (3, 0)], p=content_main)
    cmds.text(' ', bgc=title_bgc_color)
    cmds.text(script_name, bgc=title_bgc_color, fn='boldLabelFont', align='left')
    cmds.button(l='Help', bgc=title_bgc_color, c=(lambda x: build_gui_help_add_sine_attr()))
    cmds.separator(h=5, style='none')
    body_column = cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 10)], p=content_main)
    cmds.text(l='Select attribute holder first, then run script.', align='center')
    cmds.separator(h=10, style='none')
    cmds.text('Sine Attributes Prefix:')
    stretchy_system_prefix = cmds.textField(text='', pht='Sine Attributes Prefix (Optional)')
    cmds.separator(h=5, style='none')
    cmds.rowColumnLayout(nc=2, cw=[(1, 115), (2, 150)], cs=[(1, 10)], p=content_main)
    add_abs_output_chkbox = cmds.checkBox(label='Add Abs Output')
    add_prefix_nn_chkbox = cmds.checkBox(label='Add Prefix to Nice Name', value=True)
    cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 10)], p=content_main)
    cmds.separator(h=5, style='none')
    cmds.separator(h=5)
    cmds.separator(h=7, style='none')
    cmds.button(l='Add Sine Attributes', bgc=(0.6, 0.6, 0.6), c=(lambda x: validate_operation()))
    cmds.separator(h=10, style='none')
    cmds.showWindow(build_gui_add_sine_attr)
    cmds.window(window_name, e=True, s=False)
    qw = omui.MQtUtil.findWindow(window_name)
    widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/sineCurveProfile.png')
    widget.setWindowIcon(icon)
    cmds.setFocus(window_name)

    def validate_operation():
        ' Checks elements one last time before running the script '
        is_valid = False
        stretchy_name = None
        add_abs_output_value = cmds.checkBox(add_abs_output_chkbox, q=True, value=True)
        add_prefix_nn_value = cmds.checkBox(add_prefix_nn_chkbox, q=True, value=True)
        stretchy_prefix = cmds.textField(stretchy_system_prefix, q=True, text=True).replace(' ', '')
        selection = (cmds.ls(selection=True) or [])
        if (len(selection) > 0):
            target = selection[0]
            is_valid = True
        else:
            cmds.warning('Please select a target object to be the attribute holder.')
            is_valid = False
        if (stretchy_prefix != ''):
            stretchy_name = stretchy_prefix
        else:
            stretchy_name = 'sine'
        if is_valid:
            current_attributes = (cmds.listAttr(target, r=True, s=True, userDefined=True) or [])
            possible_conflicts = []
            possible_conflicts.append((stretchy_name + 'Time'))
            possible_conflicts.append((stretchy_name + 'Amplitude'))
            possible_conflicts.append((stretchy_name + 'Frequency'))
            possible_conflicts.append((stretchy_name + 'Offset'))
            possible_conflicts.append((stretchy_name + 'Output'))
            possible_conflicts.append((stretchy_name + 'Tick'))
            possible_conflicts.append((stretchy_name + 'AbsOutput'))
            for conflict in possible_conflicts:
                for attr in current_attributes:
                    if (attr == conflict):
                        is_valid = False
            if (not is_valid):
                cmds.warning('The object selected has conflicting attributes. Please change the prefix or select another object.')
        if is_valid:
            if stretchy_name:
                add_sine_attributes(target, sine_prefix=stretchy_name, tick_source_attr='time1.outTime', hide_unkeyable=False, add_absolute_output=add_abs_output_value, nice_name_prefix=add_prefix_nn_value)
                cmds.select(target, r=True)
            else:
                add_sine_attributes(target, sine_prefix=stretchy_name, tick_source_attr='time1.outTime', hide_unkeyable=False, add_absolute_output=add_abs_output_value, nice_name_prefix=add_prefix_nn_value)
                cmds.select(target, r=True)
def build_gui_add_sine_attr():
    window_name = 'build_gui_add_sine_attr'
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name)
    build_gui_add_sine_attr = cmds.window(window_name, title=(((script_name + '  (v') + script_version) + ')'), titleBar=True, mnb=False, mxb=False, sizeable=True)
    cmds.window(window_name, e=True, s=True, wh=[1, 1])
    content_main = cmds.columnLayout(adj=True)
    title_bgc_color = (0.4, 0.4, 0.4)
    cmds.separator(h=10, style='none')
    cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 10)], p=content_main)
    cmds.rowColumnLayout(nc=3, cw=[(1, 10), (2, 200), (3, 50)], cs=[(1, 10), (2, 0), (3, 0)], p=content_main)
    cmds.text(' ', bgc=title_bgc_color)
    cmds.text(script_name, bgc=title_bgc_color, fn='boldLabelFont', align='left')
    cmds.button(l='Help', bgc=title_bgc_color, c=(lambda x: build_gui_help_add_sine_attr()))
    cmds.separator(h=5, style='none')
    body_column = cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 10)], p=content_main)
    cmds.text(l='Select attribute holder first, then run script.', align='center')
    cmds.separator(h=10, style='none')
    cmds.text('Sine Attributes Prefix:')
    stretchy_system_prefix = cmds.textField(text=, pht='Sine Attributes Prefix (Optional)')
    cmds.separator(h=5, style='none')
    cmds.rowColumnLayout(nc=2, cw=[(1, 115), (2, 150)], cs=[(1, 10)], p=content_main)
    add_abs_output_chkbox = cmds.checkBox(label='Add Abs Output')
    add_prefix_nn_chkbox = cmds.checkBox(label='Add Prefix to Nice Name', value=True)
    cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 10)], p=content_main)
    cmds.separator(h=5, style='none')
    cmds.separator(h=5)
    cmds.separator(h=7, style='none')
    cmds.button(l='Add Sine Attributes', bgc=(0.6, 0.6, 0.6), c=(lambda x: validate_operation()))
    cmds.separator(h=10, style='none')
    cmds.showWindow(build_gui_add_sine_attr)
    cmds.window(window_name, e=True, s=False)
    qw = omui.MQtUtil.findWindow(window_name)
    widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/sineCurveProfile.png')
    widget.setWindowIcon(icon)
    cmds.setFocus(window_name)

    def validate_operation():
        ' Checks elements one last time before running the script '
        is_valid = False
        stretchy_name = None
        add_abs_output_value = cmds.checkBox(add_abs_output_chkbox, q=True, value=True)
        add_prefix_nn_value = cmds.checkBox(add_prefix_nn_chkbox, q=True, value=True)
        stretchy_prefix = cmds.textField(stretchy_system_prefix, q=True, text=True).replace(' ', )
        selection = (cmds.ls(selection=True) or [])
        if (len(selection) > 0):
            target = selection[0]
            is_valid = True
        else:
            cmds.warning('Please select a target object to be the attribute holder.')
            is_valid = False
        if (stretchy_prefix != ):
            stretchy_name = stretchy_prefix
        else:
            stretchy_name = 'sine'
        if is_valid:
            current_attributes = (cmds.listAttr(target, r=True, s=True, userDefined=True) or [])
            possible_conflicts = []
            possible_conflicts.append((stretchy_name + 'Time'))
            possible_conflicts.append((stretchy_name + 'Amplitude'))
            possible_conflicts.append((stretchy_name + 'Frequency'))
            possible_conflicts.append((stretchy_name + 'Offset'))
            possible_conflicts.append((stretchy_name + 'Output'))
            possible_conflicts.append((stretchy_name + 'Tick'))
            possible_conflicts.append((stretchy_name + 'AbsOutput'))
            for conflict in possible_conflicts:
                for attr in current_attributes:
                    if (attr == conflict):
                        is_valid = False
            if (not is_valid):
                cmds.warning('The object selected has conflicting attributes. Please change the prefix or select another object.')
        if is_valid:
            if stretchy_name:
                add_sine_attributes(target, sine_prefix=stretchy_name, tick_source_attr='time1.outTime', hide_unkeyable=False, add_absolute_output=add_abs_output_value, nice_name_prefix=add_prefix_nn_value)
                cmds.select(target, r=True)
            else:
                add_sine_attributes(target, sine_prefix=stretchy_name, tick_source_attr='time1.outTime', hide_unkeyable=False, add_absolute_output=add_abs_output_value, nice_name_prefix=add_prefix_nn_value)
                cmds.select(target, r=True)