summaryrefslogtreecommitdiffstats
path: root/tools/worldbuilder/code/scripts/wb_coinsplines.mel
blob: 750eb3e86acf52b48870ce473035e22ef4983e9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
global int $gCoinSplineCompleteCB = -1;

global proc wb_MCB_CreateCoinPath()
{
    global int $gCoinSplineCompleteCB;

    if ( !`contextInfo -exists CoinSplineCtx` ) 
    {
        curveCVCtx -degree 3 -me true -un true CoinSplineCtx;
		print "create\n";
    }
    else
    {
        string $currentCtx = `currentCtx`;

        if ( $currentCtx == "CoinSplineCtx" )
        {
		print "complete\n";
            ctxCompletion;

            wb_CB_CoinSplineComplete();
        }
    }

		print "select\n";
    setToolTo CoinSplineCtx;

    $gCoinSplineCompleteCB = `scriptJob -ro 1 -p "WorldBuilder" -e "ToolChanged" wb_CB_CoinSplineComplete`;
}

global proc wb_CB_CoinSplineComplete()
{ 
		print "complete callback\n";
    WB_CoinSplineComplete();
}
 
global proc wb_CoinSplinesCleanup()
{
		print "clean\n";
    global int $gCoinSplineCompleteCB;

    if ( $gCoinSplineCompleteCB != -1 )
    {
        scriptJob -k $gCoinSplineCompleteCB;
		print "kill job\n";
    }

    if ( `contextInfo -exists CoinSplineCtx` )
    {
		print "delete ui\n"; 
        deleteUI -tc CoinSplineCtx;
    }
}