Jump to content
Developer Wiki and Function Reference Links ×

Button Question, How to (really) integrate into a script


DomC

Recommended Posts

Hi

 

My Idea is, to save parameters inside a Marionette Script as a TextBlock, xml Text Block etc. doesn't matter. What a Marionette script is able to do, is to have access to objects inside the script and take them for use. 

 

Examples:

1. self.Params.y.value = vs.FInGroup(vs.GetParent(self.Handle)) Get the first Object inside a Wrapper

self.Handle is the node, the code is running "Parent is the Wrapper" and so on.

 

The new Button Feature, could show a nice Dialog Box in which I could set-up the Marionette script (And do not run every time we run the script, just by clicking on it something happens). 

The Idea is, to change something inside the marionette Script with the new "Button" Feature. The Button Feature executes a script which seems to run in another class, than the RunNode. Or something like this I do not understand. If someone here with deeper Python Knowledge could explain that, this would be great.

 

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
    this = Marionette.Node( 'GetInputNodeHandle' )    
    this.SetDescription('')
    text = Marionette.PortIn( vs.Handle(0) )  
    text.SetDescription('The text object to pull the string from') 
    Int = Marionette.OIPControl( 'Button', Marionette.WidgetType.Button, 'script', 'description')
    str = Marionette.PortOut()
    str.SetDescription('The resulting string')     
def RunNode(self):
    text = self.Params.text.value
    self.Params.str.value = vs.GetText(text)
    vs.SetText(text,'HelloRunNode')

def script(self):
    input = self.Params.text.value
    vs.AlrtDialog(str(vs.GetType(input)))
    vs.SetText(text,'HelloButton')        

Also tried with "return text" inside the RunNode. And then input = RunNode(self) and so on. 

It seems, like it's not so easy to access with the "button" to the script itself. So what kind of use could have this Button exactly? Maybe to show a Hint or a Manual for the Script? 

 

Known Workarounds:

With this Button, we could Handle to an instance, like a named Object or a Symbol, which contains the script content. That would be an indirect way to make this Button be something to change the script parameters.

 

Also the button will not work inside a wrapped script. Someone can explain this too?

 

 

 

 

 

 

 

Bildschirmfoto 2016-10-25 um 21.41.16.png

ButtonIntegration.mp4

Edited by DomC
Link to comment

Maybe I found another (better) Way to predifine Parameters inside the Marionette Script:

 

def script(self):
    vs.AlrtDialog(vs.GetName(self.Handle)) #Handle seems to be correct
	fieldvalue = "{'data' : [{'varName' : 'param1','text' : 'p1','type' : 3,'description' : '','valueType' : 3,'value' : 500,'minvalueType' : 		0,'maxvalueType' : 0},{'varName' : 'Int','text' : 'Button','type' : 16,'description' : 'script','valueType' : 6,'value' : 						'script','minvalueType' : 0,'maxvalueType' : 0}]}"
	vs.CreateText(fieldvalue) #Test
	vs.SetRField(self.Handle,'MarionetteNode','NodeDef_OIPControls',fieldvalue)

It seems, a record field inputs all parameters with python dictionary as a RAW string object. Just to find out, what kind of quotes and escapes there has to be. 

I think a Question of Quotes, Escapes and brackets. Hm .. give that up.

The good old user-database is maybe the perfect thing to tag objects for marionette integration. 

 

Edited by DomC
Link to comment
  • 1 year later...

Hello, this was posted 2016. Any further advice on the button node? any examples? DomC video moves pretty quick for me! I can't really follow it . What I'm really hoping for is a way to get the button in the OIP for a marionette object, so it maybe just brings up a text box with guidance or a web link?

Any ideas?

Thanks. 

Link to comment

The post is about storing preferences into a node by clicking the button. All Parameter we can use in a Marionette PIO are available in the Info-Palette. If we could use a (complex) Dialog with several detail parameter for the object, this would help to keep a powerfull object easy to use.

 

The Issue with that is, that the button (The Dialog) do not work anymore inside a PIO. It just works in a wrapper or as a node. The other wish (predifined parameters, complexe setting dialoge) could be solved somehow.

 

If you just need a button-use example. I attached a button, which shows an simple alert dialog

Button Example.vwx

  • Like 1
Link to comment
  • 2 years later...

With your wish there are some problems which I could not yet solve or which might not be solvable at all.

1. How should the values be stored? If they are saved in a text field, this is also visible in the finished MarionetteObject, which is in my opinoin a bit unattractive.

2. When the button is clicked, the previous nodes are not processed. Therefore it is not possible to calculate the options. The dialog always shows the default values of the node.

 

Therefor it is probably the better option to simply use a popup node.

If someone still wants to continue working on it I have uploaded the approach for the node here.

Popup Dialog on Click.vwx

 

Same text in german

Bei deinem Wunsch gibt es einige Probleme die ich noch nicht lösen konnte oder die eventuell gar nicht lösbar sind.

1. Wie sollen die Werte abgespeichert werden? Wenn sie in einem Textfeld gespeichert werden ist dieses in dem fertigen MarionetteObject ebenfalls sichtbar, was in meinen Augen ein wenig unschön ist.

2. Beim Klick auf den Button werden die vorhergehenden Nodes nicht ausgeführt. Daher ist es nicht möglioch die Optionen zu berechnen. Im Dialog werden immer die Defaultwerte des Nodes angezeigt.

 

Von demher ist es wahrscheinlich die bessere Option einfach ein Popup-Node zu verwenden.

 

Wenn trotzdem jemand weiterbasteln möchte habe ich den Ansatz für den Node hier hochgeladen.

 

  • 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...