Last active
August 10, 2019 08:59
-
-
Save Roumenov/3cdf69110165e4cecc337418fc2dc83e to your computer and use it in GitHub Desktop.
need to sort meshes relative to each other by various parameters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
import maya.mel as mel | |
def mesh_density_calc(mesh, operation = 'density'): | |
#TODO: add line ot save existing selection and reselect at the end | |
pm.select(mesh) | |
if operation == 'volume': | |
return mel.eval('computePolysetVolume ') | |
elif operation == 'polycount': | |
mesh_polycount = pm.polyEvaluate(f=1)#could also use this to get area and modulate specular against area/density | |
return (mesh_polycount) | |
elif operation == 'density': | |
mesh_volume = mel.eval('computePolysetVolume ') | |
mesh_polycount = pm.polyEvaluate(f=1) | |
return (mesh_volume/mesh_polycount) | |
else: | |
warning('invalid operation parameter') | |
#print("=================") | |
#print('Mesh has a volume of %s, with a polycount of %s, for a density value of %s') %(mesh_volume, mesh_polycount, mesh_density) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment