Setting the color of individual polygons



  • On 08/07/2016 at 04:23, xxxxxxxx wrote:

    Hi all,

    I'm using a Python Generator object to create a cuboid using SetPoint and SetPolygon.
    Is it possible to have these polygons drawn in different colors (just editor colors, not materials)?



  • On 11/07/2016 at 09:00, xxxxxxxx wrote:

    Hi,

    welcome to the Plugin Café forums 🙂

    An object's display color (Object's Attribute Manager -> Basic Tab -> Use Color + Display Color) can not be used for this as it can't be restricted to just a set of polygons.
    Actually there's no real solution in Python Generator or even in Python in general.

    One way to circumvent this, would be to create Texture and Selection tags on the created object and link them to already existing materials. Be aware, you are not allowed to change the scene from within the Python Generator, so creating materials for this in the Python Generator is no option. Also I know, you wanted to achieve this without materials.

    Another problem is, that we are currently lacking a data structure to store colors per polygon.

    One option could be to implement a plugin (ObjectData) instead of using the Python Generator and then use the Draw() function to directly draw to the viewport, whatever you want. But you can not change the drawing of the polygons itself, all you could do by this is add some sort of information on top.


Log in to reply