Hazelight/uvpackit

Allow user to select which UV Map to pack

Closed this issue · 1 comments

As things are right now, the command is hard-coded to use the vmap named "Texture".

  check(meshmap.SelectByName(LXi_VMAP_TEXTUREUV, "Texture"));

Adding a drop down allowing users to specify a vmap that is mutual to all active selection would likely be better. Could be done making a string argument with UI Value Hints.

Doing a similar thing in Python

def get_map_names():
    """ Get the uv coord vmaps common for all selected meshes. 

    :returns: list of vmap names common to all selected meshes
    :rtype: list

    """
    names = list()
    for mesh in modo.Scene().selectedByType('mesh'):
        maps = mesh.geometry.vmaps.getMapsByType(lx.symbol.i_VMAP_TEXTUREUV)
        names.append(set(map.name for map in maps))

    if names:
        # set of uv map names common to all selected meshes,
        return list(names[0].intersection(*names[1:]))

    return []

And in the command overriding the method arg_UIValueHints

    def arg_UIValueHints(self, index):
        if index == 0:
            mapnames = get_map_names()
            return ValueHints(mapnames, mapnames)

Solved in release 1.1.0