forked from lookbothways/vfxTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomiseObjectsStepExport
94 lines (64 loc) · 2.39 KB
/
randomiseObjectsStepExport
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Random scale selected, rotate selected - THIS SCRIPT IS NOT FINISHED. Though it works.
import maya.cmds as cmds
import random
import time
randomiseThese = cmds.ls(sl=True)
def randomiseObjects():
i = []
for i in randomiseThese:
randX = random.random()*100.5
randY = random.random()*100.5
randZ = random.random()*100.5
randRotX = (cmds.getAttr( i+'.rotateX')*randX)
randRotY = (cmds.getAttr( i+'.rotateX')*randY)
randRotZ = (cmds.getAttr( i+'.rotateX')*randZ)
cmds.setAttr( i+'.rotate', randRotX, randRotY, randRotZ)
"""
#frame advance by step
step = 1
timeNow = cmds.currentTime( query=True )
print timeNow
nextStep = timeNow+step
cmds.currentTime( nextStep, update=True, edit=True )
timeNow = cmds.currentTime( query=True )
"""
#end of part 1
# Export all selected objects into standin by frame-step (for exporting walls)
"""
Get the correct mask value using these constants:
AI_NODE_UNDEFINED 0x0000
AI_NODE_OPTIONS 0x0001
AI_NODE_CAMERA 0x0002
AI_NODE_LIGHT 0x0004
AI_NODE_SHAPE 0x0008
AI_NODE_SHADER 0x0010
AI_NODE_OVERRIDE 0x0020
AI_NODE_DRIVER 0x0040
AI_NODE_FILTER 0x0080
AI_NODE_ALL 0xFFFF
mask = arnold.AI_NODE_OPTIONS | arnold.AI_NODE_LIGHT | arnold.AI_NODE_SHAPE | arnold.AI_NODE_OVERRIDE | arnold.AI_NODE_FILTER
print mask
mask=173 mesh no shaders, but tse on.
mask=253 export all the things
"""
step = 1
#directory is this. INCLUDE THE SLASH
dir = "/mnt/projects/aft/publish/assets/hamburg/geo/newGirders/"
while cmds.currentTime( query=True ) < 5:
frameNow = str(round(cmds.currentTime( query=True )))[0:-2]
# CHANGE THIS to groupname
name = "allGirds_"+frameNow
timeNow = cmds.currentTime( query=True )
print timeNow
nextStep = timeNow+step
cmds.currentTime( nextStep, update=True, edit=True )
timeNow = cmds.currentTime( query=True )
# export standin to this directory:
#Makes the export path
export_file = "{}{}.ass".format(dir,name)
print "Exporting "+export_file
# NAME IS THIS. Change this to the group you want to export per frame-step
cmds.select( 'allGirds' )
cmds.arnoldExportAss(f=export_file,fsh=True,s=True,frameStep=1,mask=253,lightLinks=0,shadowLinks=0,selected=True,boundingBox=True)
randomiseObjects()
#end