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)
Checks elements one last time before running the script
def validate_operation():
    '  '
    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)