Maxscript: Random Transform

Lohnt nicht für github, daher kommt das Script hierher.

Es lassen sich damit eine Anzahl Objekt per Zufall transformieren.

RandomTransform

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
54
55
56
57
58
59
60
rollout RandomTransform "Random Transform" width:210 height:290 (
    local sel = selection
    
    groupBox grpTrans "Moving" pos:[5,5] width:200 height:80
        spinner spnTransMinX "Min X: " pos:[25,25] width:75 height:16 range:[-1000000.00,1000000.00,0.00] type:#worldunits
        spinner spnTransMinY "Min Y: " pos:[25,45] width:75 height:16 range:[-1000000.00,1000000.00,0.00] type:#worldunits
        spinner spnTransMinZ "Min Z: " pos:[25,65] width:75 height:16 range:[-1000000.00,1000000.00,0.00] type:#worldunits
    
        spinner spnTransMaxX "Max X: " pos:[125,25] width:75 height:16 range:[-1000000.00,1000000.00,0.00] type:#worldunits
        spinner spnTransMaxY "Max Y: " pos:[125,45] width:75 height:16 range:[-1000000.00,1000000.00,0.00] type:#worldunits
        spinner spnTransMaxZ "Max Z: " pos:[125,65] width:75 height:16 range:[-1000000.00,1000000.00,0.00] type:#worldunits
    
    groupBox grpRot "Rotating" pos:[5,90] width:200 height:80
        spinner spnRotMinX "Min X: " pos:[25,110] width:75 height:16 range:[-360.00,360.00,0.00]
        spinner spnRotMinY "Min Y: " pos:[25,130] width:75 height:16 range:[-360.00,360.00,0.00]
        spinner spnRotMinZ "Min Z: " pos:[25,150] width:75 height:16 range:[-360.00,360.00,0.00]
    
        spinner spnRotMaxX "Max X: " pos:[125,110] width:75 height:16 range:[-360.00,360.00,0.00]
        spinner spnRotMaxY "Max Y: " pos:[125,130] width:75 height:16 range:[-360.00,360.00,0.00]
        spinner spnRotMaxZ "Max Z: " pos:[125,150] width:75 height:16 range:[-360.00,360.00,0.00]
        
    groupBox grpScale "Scaling" pos:[5,175] width:200 height:80
        spinner spnScminX "Min X: " pos:[25,195] width:75 height:16 range:[0.00,10000.00,100]
        spinner spnScminY "Min Y: " pos:[25,215] width:75 height:16 range:[0.00,10000.00,100]
        spinner spnScminZ "Min Z: " pos:[25,235] width:75 height:16 range:[0.00,10000.00,100]
        
        spinner spnScmaxX "Max X: " pos:[125,195] width:75 height:16 range:[0.00,10000.00,100]
        spinner spnScmaxY "Max Y: " pos:[125,215] width:75 height:16 range:[0.00,10000.00,100]
        spinner spnScmaxZ "Max Z: " pos:[125,235] width:75 height:16 range:[0.00,10000.00,100]
    
    
    button btnTrans "Random Transform" pos:[5,265] width:200 height:20
 
    on btnTrans pressed do (
        if sel.count == 0 then (
            MessageBox ("Please select Objects first!") title:"Random Transform"
            ) else (
            undo "Random Transform" on (
                for i = 1 to sel.count do (
                    randx = random spnTransMinX.value spnTransMaxX.value
                    randy = random spnTransMinY.value spnTransMaxY.value
                    randz = random spnTransMinZ.value spnTransMaxZ.value
                    sel[i].pos = [randx + sel[i].pos.x, randy + sel[i].pos.y, randz + sel[i].pos.z]
                    randRotx = random spnRotMinX.value spnRotMaxX.value
                    randRoty = random spnRotMinY.value spnRotMaxY.value
                    randRotz = random spnRotMinZ.value spnRotMaxZ.value
                    rotate sel[i] (eulerangles randRotx randRoty randRotz)
                    randScaleX = random (spnScminX.value/100) (spnScmaxX.value/100)
                    randScaleY = random (spnScminY.value/100) (spnScmaxY.value/100)
                    randScaleZ = random (spnScminZ.value/100) (spnScmaxZ.value/100)
                    scale sel[i] [randScaleX, randScaleY, randScaleZ]
                    )
                )
            )
    )
    
)
try ( destroyDialog RandomTransform ) catch ()
 
createDialog RandomTransform style:#(#style_toolwindow, #style_border, #style_sysmenu)

Download: RandomTransform

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.