Notifications
Clear all

[Closed] Painter interface "End paint session" doesn't work?

Try as I might I cant seem to get the painter interface systemEnd callback to trigger. Does it work?

thesphere=sphere pos:[0,0,0]
  
  fn startStroke = print "Handle start stroke here"
  
  fn paintStroke = print "Handle paint stroke here"
  
  fn endStroke = print "Handle end stroke here"
  
  fn cancelStroke = print "Handle cancel stroke here"
  
  fn systemEnd = print "Handle system end here"
  
  thePainterInterface.ScriptFunctions startStroke paintStroke endStroke cancelStroke systemEnd
  
  nodeList = thesphere
  
  thePainterInterface.initializeNodes 0 nodeList
  thePainterInterface.startPaintSession()
  

Now I assume calling thePainterInterface.endPaintSession() should trigger the systemEnd function? (not included in above code, but can be entered manually into listener)

I can’t get this to work… whatever is in the systemEnd function, it gets ignored no matter how I call thePainterInterface.endPaintSession(). The painter interface closes correctly, but no callback. All the other callbacks work fine and print their statement.

Have I missed the point of the systemEnd function? If so when does that get called?

2 Replies

Hi Rorschach,
as you stated thePainterInterface.endPaintSession() releases the painting 3ds Command Mode, but it doesn’t call the “systemEnd” function specified in thePainterInterface.ScriptFunctions(). It is the command to place inside your “systemEnd” function to shut down thePainterInterface. “systemEnd” function is called by the system when the painting session is closed by some other event, like activating Move, Rotate, Scale, changing SubObjectLevel, and so on. Here is a piece of code that shows what I mean. Run it, start and stop thePainterInterface, then try staring it and switch to Move Mode, you’ll se the “systemEnd” function called, while the checkButton is still pressed.

rollout rolTest "PI Test"
(
    local theSphere = undefined

    checkButton cbtRun "Paint!" width:90 align:#center offset:[0, -2]

    function startStroke = print "Handle start stroke here"

    function paintStroke = print "Handle paint stroke here"

    function endStroke = print "Handle end stroke here"

    function cancelStroke = print "Handle cancel stroke here"

    function systemEnd =
    (
        print "Handle system end here"
        thePainterInterface.endPaintSession()
    )

    on rolTest open do
    (
        thePainterInterface.ScriptFunctions startStroke paintStroke endStroke cancelStroke systemEnd
    )

    on cbtRun changed bState do
    (
        if (bState) then
        (
            theSphere = sphere()

            thePainterInterface.initializeNodes 0 theSphere
            thePainterInterface.startPaintSession()
        )
        else
        (
            systemEnd()
        )
    )

) -- End Rollout

createDialog rolTest 96 27 style:#(#style_toolwindow, #style_border, #style_sysmenu)
  • Enrico

Great, thanks for the clarification.