Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Querying UI fields
  RSS 2.0 ATOM  

Querying UI fields
Rate this thread
 
60333
 
Permlink of this thread  
avatar
  • Total Posts: 6
  • Joined: 14 September 2011 12:38 AM

Hello Everyone,

I’m trying to ‘get’ user entered values from a UI. I’ve looked through the MB help examples and have been investigating this for days now.

The only way I’ve seen this done is by declaring items as global objects. I used to script in MEL and typically avoided too many global declarations, is there a local way to read the FBEdit(), or is declaring globally the recommended workflow for python in MotionBuilder?

I have an example UI here, type in the field above and click the button…

def populateToolbox(ui):
    
al FBAddRegionParam(0,FBAttachType.kFBAttachLeft,"")    
    
at FBAddRegionParam(0,FBAttachType.kFBAttachTop,"")    
    
ar FBAddRegionParam(0,FBAttachType.kFBAttachRight,"")    
    
an FBAddRegionParam(200,FBAttachType.kFBAttachNone,"")    
    
ui.AddRegion("main","main"alataran)    
    
mainLyt VBoxLayout()    
    
ui.SetControl("main",mainLyt)
    
    global 
effectorField
    effectorField 
FBEdit()
    
effectorField.Caption 'Layer Mode'
    
mainLyt.Add(effectorField,50)
    
    
b1 FBButton()
    
b1.Caption 'Print Text Above'
    
b1.OnClick.Add(doIt)
    
mainLyt.Add(b125)
    
def doIt(controlevent):
    print 
effectorField.Text

def newUI
():
    
ui CreateUniqueTool('Test UI')
    
ui.StartSizeX 200
    ui
.StartSizeY 120
    populateToolbox
(ui)
    
ShowTool(ui)

newUI()

Any help appreciated,

Steve.



Replies: 0