spotimages.blogg.se

Maya colorset script
Maya colorset script






maya colorset script
  1. #Maya colorset script how to
  2. #Maya colorset script code
  3. #Maya colorset script windows

Yield (red_stream.next(), green_stream.next(), blue_stream.next())ĭef merge_channels(model, red_set, green_set, blue_set): Return iter(cmds.pol圜olorPerVertex(mesh + ".vtx", q=True, rgb=True)) # generator!ĭef assemble( red_stream, green_stream, blue_stream): Here’s an untested thought experiment on how you could do this in cmds without anything too fancy but using generators to keep the memory load lower:Ĭmds.pol圜olorSet(mesh, colorSet = setname, currentColorSet = 1) Value = cmds.pol圜olorPerVertex(vertex, q = 1, b = 1) # query valueĬmds.pol圜olorPerVertex(vertex, b = value) # apply value Value = cmds.pol圜olorPerVertex(vertex, q = 1, g = 1) # query valueĬmds.pol圜olorPerVertex(vertex, a = value) # apply valueĬmds.pol圜olorSet(colorSet = "outline", currentColorSet = 1) # set source color setĬmds.pol圜olorPerVertex(vertex, g = value) # apply valueĬmds.pol圜olorSet(colorSet = "spec", currentColorSet = 1) # set source color set Value = cmds.pol圜olorPerVertex(vertex, q = 1, r = 1) # query valueĬmds.pol圜olorSet(colorSet = "tolerance", currentColorSet = 1) # set destination color setĬmds.pol圜olorPerVertex(vertex, r = value) # apply value Vertex = mesh + ".vtx" # build a vertex string, eg mesh.vtxĬmds.pol圜olorSet(colorSet = "shading", currentColorSet = 1) # set source color set If not "tolerance" in cmds.pol圜olorSet(q = 1, allColorSets = 1): # make color set if it doesn't existĬmds.pol圜olorSet(colorSet = "tolerance", create = 1) VtxCount = cmds.polyEvaluate(mesh, vertex = 1)

maya colorset script

Here is the code: import maya.cmds as cmds I’m interested to hear how I should be doing this where memory usage is concerned, since it will make good reference in the future. plain cmds, yeah I could do it with the API but it was just meant as a quick and dirty method, I’ve noticed I can do it inside of Maya by setting color set operation to ‘add’ instead of ‘over’, duplicating all 3 primary sets, and merging them with a new 4th set to get the same outcome without spending much time.(edit) Also: you’re just doing isolated ops on each vertex? Or does processing one vert involve asking questions of others?

#Maya colorset script code

Code or at least pseudocode would make it much easier to diagnose. The way you do your loops will determine a lot about how much you have in memory at any given time and how long Python will wait before dropping things. If you are really running out of RAM that is the reason things go slow: you’re dropping out of electronic access times in real RAM into mechanical access times for VRAM. For scores of thousands of verts it will be slow and cmds vs api times will start to dominate. If you’re crawling at that size, it’s probably a frankenstein loop that’s generating unneeded work. How big is the mesh in question? For counts in the low thousands (1) and (2) should not matter.

#Maya colorset script how to

Are you thinking about how to manage your loops? If you are generating a lot of long lists – instead of, say, using generators – you’ll be fragmenting memory like crazy.Are you using API calls or just plain cmds? Usually for this kind of thing the API will be significantly faster than cmds.I’m very likely doing this wrong, but the point of this thread isn’t how to achieve what I’m doing, it’s very specifically the questions listed. It takes a very long time and my system barely survives. The description above iterated through each color set as well, I’ve modified it hoping it will aid performance. My script is very specific to what I’m currently working on and it uses hard-coded values to save time. Why does Maya use <20% of my CPU, or more specifically, what is the bottle neck here - I assume RAM speed?Why isn’t it releasing the memory as it goes through each loop, can I force this? What is being stored that has to be kept every iteration, other than the current index…? It shouldn’t use that much memory, right? As I’m posting this Maya is using > 6GB of RAM thats continuously being compressed just to keep it’s head above water.

#Maya colorset script windows

The shader I’m developing takes information from all four (RGBA) channels to use as information for the shader, such as how much shading occurs at each vertex or specularity, the channels aren’t related.įor the heavier meshes, while I do it, it will use my RAM well beyond capacity and windows compresses it as it goes and it takes forever. The reason for this is that… for one of those kinds of reasons that result in a slow head shake with averted eye contact, Maya can’t paint vertex colors per channel. I’m performing a very heavy task that basically goes… for every mesh, for every color set (3 each) on each mesh, shove the specified channels into a new color set by iterating over every vertex in the mesh.








Maya colorset script