def fluidEmitter(*args, **kwargs): res = cmds.fluidEmitter(*args, **kwargs) if not kwargs.get('query', kwargs.get('q', False)): res = _factories.maybeConvert(res, _general.PyNode) # unpack create/edit list result if isinstance(res, list) and len(res) == 1 and not kwargs.get('query', kwargs.get('q', False)): res = res[0] return res
def _buildFluidEmitter(newName): """ Function to build a fluid emitter @param newName: The name of the emitter @type newName: String """ if not cmds.objExists(newName): newFluid = cmds.fluidEmitter(name = newName, type='volume', densityEmissionRate=0.1, heatEmissionRate=0.1, fuelEmissionRate=1, fluidDropoff=0.1, rate=100.0, cycleEmission='none', cycleInterval=1, maxDistance=1, minDistance=0, volumeShape = "sphere" ) return newFluid else: return [newName]
def _addWakeEmitter(): """ Quick add additional linked emitter for the app UI only This builds a linked emitter to the scene for custom wakes such as around buildings etc """ debug(None, method = '_addWakeEmitter', message = 'Adding wake emmiter now..', verbose = False) #get camera from current view currentPanel = cmds.getPanel(withFocus= True) or 'modelPanel4' debug(None, method = '_addWakeEmitter', message = 'currentPanel: %s' % currentPanel, verbose = False) panelType = cmds.getPanel(typeOf= currentPanel ) debug(None, method = '_addWakeEmitter', message = 'panelType: %s' % panelType, verbose = False) if panelType != "modelPanel": print "Model panel not selected, please make view port live and try again" else: camera=cmds.modelPanel(currentPanel, q=True, camera = True) debug(None, method = '_addWakeEmitter', message = 'camera: %s' % camera, verbose = False) cameraShape =cmds.listRelatives(camera) or camera debug(None, method = '_addWakeEmitter', message = 'cameraShape: %s' % cameraShape, verbose = False) position = cmds.camera(cameraShape, q=True, worldCenterOfInterest= True) #build a new vector import maya.OpenMaya as om vec = om.MVector(position[0],0,position[2]) # create a fluid emitter emitter = cmds.fluidEmitter( pos=vec, name = "additionalEmitter_WAKE#", type='volume', densityEmissionRate=-3000, heatEmissionRate=50000, fuelEmissionRate=0, fluidDropoff=0.1, rate=150.0, cycleEmission='none', cycleInterval=1, maxDistance=1, minDistance=0, volumeShape = "sphere" ) # connect to fluids cmds.connectDynamic(CONST.FOAM_FLUID_SHAPENODE, em = emitter) cmds.connectDynamic(CONST.WAKE_FLUID_SHAPENODE, em = emitter) # set some presets cmds.setAttr('%s.rate' % emitter[0], 150) cmds.setAttr('%s.fluidDensityEmission' % emitter[0], -3000) cmds.setAttr('%s.fluidHeatEmission' % emitter[0], 50000) cmds.setAttr('%s.fuelMethod' % emitter[0], 0) cmds.setAttr('%s.fluidJitter' % emitter[0], 0) cmds.setAttr('%s.motionStreak' % emitter[0], 1) debug(None, method = '_addWakeEmitter', message = 'FINISHED..', verbose = False)
def _buildFluidEmitter(newName): """ Function to build a fluid emitter @param newName: The name of the emitter @type newName: String """ if not cmds.objExists(newName): newFluid = cmds.fluidEmitter(name=newName, type='volume', densityEmissionRate=0.1, heatEmissionRate=0.1, fuelEmissionRate=1, fluidDropoff=0.1, rate=100.0, cycleEmission='none', cycleInterval=1, maxDistance=1, minDistance=0, volumeShape="sphere") return newFluid else: return [newName]
def defaultButtonPush04(*args): charSelection = cmds.ls(sl=True) SelectionError() charName = charSelection[0] objectSplit = charName.split(':') FinalCharName = objectSplit[0] CharGeo_Duplicate01 = cmds.duplicate(charName) cmds.parent(world=True) mainGroup = cmds.group(n = "%s_wake_foam" % FinalCharName) groupPolygon = [] for x in cmds.listRelatives(mainGroup, children = True, fullPath = True): for f in ['hull_geo', 'body_geo', 'geo','HubcapOld_geo']: if f in x: groupPolygon.append(x) cmds.select(groupPolygon, replace = True) EmitterObject = cmds.fluidEmitter(type='surface', der=1, her=2, fer=3, fdr=1.5, r=100.0, cye='none', cyi=1, mxd=0, mnd=0 ) cmds.connectDynamic("oceanWakeTextureShape", em = EmitterObject[1]) cmds.connectDynamic("oceanWakeFoamTextureShape", em = EmitterObject[1]) cmds.setAttr('%s.maxDistance' % EmitterObject[1], 1) cmds.setAttr('%s.densityMethod' % EmitterObject[1], 2) cmds.setAttr('%s.fluidDensityEmission' % EmitterObject[1], 100) cmds.setAttr('%s.heatMethod' % EmitterObject[1], 2) cmds.setAttr('%s.fluidHeatEmission' % EmitterObject[1], 500) cmds.setAttr('%s.fluidFuelEmission' % EmitterObject[1], 1) cmds.setAttr('%s.fluidDropoff' % EmitterObject[1], 4.5) cmds.setAttr('%s.motionStreak' % EmitterObject[1], 1) cmds.setAttr('%s.fluidJitter' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceSpeed' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceFrequencyX' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceFrequencyY' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceFrequencyZ' % EmitterObject[1], 0) print "%s:cog_ctrl" % FinalCharName cmds.parentConstraint( "%s:cog_ctrl" % FinalCharName, mainGroup, maintainOffset = True )
def run(): selected = cmds.ls(sl=True) fattrs = { 'squareVoxels': 0, 'dimensionsW': 30, 'dimensionsH': 6, 'dimensionsD': 30, 'densityMethod': 0, 'velocitySwirl': 5, 'highDetailSolve': 3, 'boundaryDraw': 4 } fc = mel.eval('create3DFluid 10 10 10 10 10 10') scale = 20 print(fc) cmds.setAttr(fc + '.resolution', 100, 20, 100) for attr in fattrs: cmds.setAttr(fc + '.' + attr, fattrs[attr]) cmds.select(selected[0]) fm = cmds.fluidEmitter(type='surface', densityEmissionRate=1, heatEmissionRate=0, fuelEmissionRate=0, fluidDropoff=2, rate=100, cycleInterval=1, maxDistance=1, minDistance=0)[1] cmds.connectDynamic(fc, em=fm) cmds.setAttr(fm + '.emitterType', 2) pt = cmds.particle() cmds.setAttr(pt[1] + '.conserve', 0) cmds.select(selected[0]) pm = cmds.emitter(type='surface', rate=100000, scaleRateByObjectSize=0, needParentUV=0, cycleInterval=1, speed=0, speedRandom=0, normalSpeed=1, tangentSpeed=0) cmds.connectDynamic(pt[1], em=pm) va = cmds.volumeAxis(pos=(0, 0, 0), magnitude=5, attenuation=0, invertAttenuation=0, awayFromCenter=0, awayFromAxis=0, aroundAxis=1, alongAxis=0, drs=0, turbulence=0.1, turbulenceSpeed=0.2, detailTurbulence=1)[0] cmds.setAttr('.sx', scale) cmds.setAttr('.sy', scale) cmds.setAttr('.sz', scale) cmds.connectDynamic(fc, f=va) cmds.connectDynamic(pt, f=fc) cmds.connectAttr('time1.outTime', va + '.time') cmds.setAttr(selected[0] + '.overrideEnabled', 1) cmds.setAttr(selected[0] + '.overrideDisplayType', 1) # parent under a group grp = cmds.group(n='vortex', em=True) cmds.parent(va, grp) cmds.parent(fc, grp) cmds.parent(pt, grp) #cmds.parent(selected[0], grp) pass
def _addWakeEmitter(): """ Quick add additional linked emitter for the app UI only This builds a linked emitter to the scene for custom wakes such as around buildings etc """ debug(None, method='_addWakeEmitter', message='Adding wake emmiter now..', verbose=False) #get camera from current view currentPanel = cmds.getPanel(withFocus=True) or 'modelPanel4' debug(None, method='_addWakeEmitter', message='currentPanel: %s' % currentPanel, verbose=False) panelType = cmds.getPanel(typeOf=currentPanel) debug(None, method='_addWakeEmitter', message='panelType: %s' % panelType, verbose=False) if panelType != "modelPanel": print "Model panel not selected, please make view port live and try again" else: camera = cmds.modelPanel(currentPanel, q=True, camera=True) debug(None, method='_addWakeEmitter', message='camera: %s' % camera, verbose=False) cameraShape = cmds.listRelatives(camera) or camera debug(None, method='_addWakeEmitter', message='cameraShape: %s' % cameraShape, verbose=False) position = cmds.camera(cameraShape, q=True, worldCenterOfInterest=True) #build a new vector import maya.OpenMaya as om vec = om.MVector(position[0], 0, position[2]) # create a fluid emitter emitter = cmds.fluidEmitter(pos=vec, name="additionalEmitter_WAKE#", type='volume', densityEmissionRate=-3000, heatEmissionRate=50000, fuelEmissionRate=0, fluidDropoff=0.1, rate=150.0, cycleEmission='none', cycleInterval=1, maxDistance=1, minDistance=0, volumeShape="sphere") # connect to fluids cmds.connectDynamic(CONST.FOAM_FLUID_SHAPENODE, em=emitter) cmds.connectDynamic(CONST.WAKE_FLUID_SHAPENODE, em=emitter) # set some presets cmds.setAttr('%s.rate' % emitter[0], 150) cmds.setAttr('%s.fluidDensityEmission' % emitter[0], -3000) cmds.setAttr('%s.fluidHeatEmission' % emitter[0], 50000) cmds.setAttr('%s.fuelMethod' % emitter[0], 0) cmds.setAttr('%s.fluidJitter' % emitter[0], 0) cmds.setAttr('%s.motionStreak' % emitter[0], 1) debug(None, method='_addWakeEmitter', message='FINISHED..', verbose=False)
charName = charSelection[0] objectSplit = charName.split(':') FinalCharName = objectSplit[0] CharGeo_Duplicate01 = cmds.duplicate(charName) cmds.parent(world=True) mainGroup = cmds.group(n = "%s_wake_foam" % FinalCharName) groupPolygon = [] for x in cmds.listRelatives(mainGroup, children = True, fullPath = True): for f in ['hull_geo', 'body_geo', 'geo']: if f in x: groupPolygon.append(x) cmds.select(groupPolygon, replace = True) EmitterObject = cmds.fluidEmitter(type='surface', der=1, her=2, fer=3, fdr=1.5, r=100.0, cye='none', cyi=1, mxd=0, mnd=0 ) cmds.connectDynamic("oceanWakeTextureShape", em = EmitterObject[1]) cmds.connectDynamic("oceanWakeFoamTextureShape", em = EmitterObject[1]) cmds.setAttr('%s.maxDistance' % EmitterObject[1], 1) cmds.setAttr('%s.densityMethod' % EmitterObject[1], 2) cmds.setAttr('%s.fluidDensityEmission' % EmitterObject[1], 100) cmds.setAttr('%s.heatMethod' % EmitterObject[1], 2) cmds.setAttr('%s.fluidHeatEmission' % EmitterObject[1], 1000) cmds.setAttr('%s.fluidFuelEmission' % EmitterObject[1], 1) cmds.setAttr('%s.fluidDropoff' % EmitterObject[1], 4.5) cmds.setAttr('%s.motionStreak' % EmitterObject[1], 1) cmds.setAttr('%s.fluidJitter' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceSpeed' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceFrequencyX' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceFrequencyY' % EmitterObject[1], 0) cmds.setAttr('%s.turbulenceFrequencyZ' % EmitterObject[1], 0)