Jump to content
Developer Wiki and Function Reference Links ×

manipulate Popup node


Recommended Posts

Hi,

 

ich want to manipulate the popup node 

 

#Modified April 2017
@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
    #Name
    this = Marionette.Node( 'Popup' )    
    this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.')
    
    #Input Ports
    
    #OIP Controls
    input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30'])
    input.SetDescription('an OIP control representing the options designated within the script editor')
    
    #Output Ports
    output = Marionette.PortOut('i')
    output.SetDescription('an integer corresponding with the option selected in the OIP. Returned values range from 0 to one less than the number of options.')
    
#BEHAVIOR

def RunNode(self):
    #inputs
    input = self.Params.input.value
    
    #script
    
    #outputs
    self.Params.output.value = input

 

that i get as output the string i popped up not int 0,1,2....

 

i think thats pretty easy but i dont know the exact syntax of the code to do it by myself.

 

maybe someone can help me quickly with this easy stuff :()

Link to comment

i asked the chatGPT, whether he can manipulate the node for me.

 

Du

Modified April 2017

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):

APPEARANCE

#Name this = Marionette.Node( 'Popup' )    this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.') #Input Ports #OIP Controls input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') #Output Ports output = Marionette.PortOut('i') output.SetDescription('an integer corresponding with the option selected in the OIP. Returned values range from 0 to one less than the number of options.')

BEHAVIOR

def RunNode(self):
    #inputs
    input = self.Params.input.value

#script #outputs self.Params.output.value = input

ich moechte gerne als Output keine integerwerte, sondern den Text, der im Popupausgewaehlt wird (translated after by hand: i want as output not the int i want the string which i choosed in the popup)

 

er meinte

 

ChatGPT

Modified April 2017

@Marionette.NodeDefinition
class Params(metaclass=Marionette.OrderedClass):
    # APPEARANCE
    # Name
    this = Marionette.Node('Popup')
    this.SetDescription(
        'This node demonstrates the use of a Popup OIP control. The values returned by this node will be the text of the option selected from the list.')

# Input Ports # OIP Controls input = Marionette.OIPControl('Popup', Marionette.WidgetType.Popup, 0,                               ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25',                                'Extrusionsflaeche QR 30']) input.SetDescription('an OIP control representing the options designated within the script editor') # Output Ports output = Marionette.PortOut('s') output.SetDescription('a string corresponding with the option selected in the OIP.') # BEHAVIOR def RunNode(self):     # inputs     input = self.Params.input.value     # script     # outputs     self.Params.output.value = input

 

so he excactly understood what i wanted, he changed the param typ from int to string and adapted the output.set description but he did not any other modification in the code.

 

 

Link to comment

CHATgpt solved it in the 5. try

 

#Modified April 2017
@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
    #Name
    this = Marionette.Node( 'Popup' )    
    this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.')
    
    #Input Ports
    
    #OIP Controls
    input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30'])
    input.SetDescription('an OIP control representing the options designated within the script editor')
    
    #Output Ports
    output = Marionette.PortOut('s')
    output.SetDescription('a string representing the option selected in the OIP..')
    
#BEHAVIOR

def RunNode(self):
    #inputs
    input = self.Params.input.value
    
    #script
    options = ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30']
    selection_index = int(input) # convert the string input to an integer index
    selection = options[selection_index] # get the corresponding option

    #outputs
    self.Params.output.value = selection
 

Link to comment

i had to ask: 

 

how to manipulate this code

Modified April 2017
@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):

APPEARANCE

Name

this = Marionette.Node( 'Popup' )
this.SetDescription('This node demonstrates the use of a Popup OIP control. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.')

Input Ports

OIP Controls

input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Extrusionsflaeche RR 15x25', 'Extrusionsflaeche QR 20', 'Extrusionsflaeche QR 25', 'Extrusionsflaeche QR 30'])
input.SetDescription('an OIP control representing the options designated within the script editor')

Output Ports

output = Marionette.PortOut('s')
output.SetDescription('an integer corresponding with the option selected in the OIP. Returned values range from 0 to one less than the number of options.')
BEHAVIOR
def RunNode(self):
    #inputs
    input = self.Params.input.value

script

outputs

self.Params.output.value = input

 

to have a string as an output which is corresponding to the popup selection instead of the integer of the input?

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...