PolygonColor



  • On 15/11/2017 at 12:52, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hello, I would like to know a way for get/set the color state of a polygon.
    For exemple if you select a polygon, the color is VIEWCOLOR_ACTIVEPOLYGON, if you hover the polygon with the selection tool the polygon seem to be greyish.

    So I would like to access thoses informations. And is it possible to draw custom color? Moreover thoses information belong to the PolygonObject or the BaseView?

    I know I can create my own object and then draw just in front of the existing polygon, but I would like to avoid creating object if it's possible.

    Thanks in advance.



  • On 15/11/2017 at 23:16, xxxxxxxx wrote:

    I don't think the polygons themselves have a color state you can retrieve or set.
    The fact a polygon is selected or not is stored in a (hidden) selection tag assigned to the polygon object.
    As such it is when the drawing happens that is decided which color each polygon needs to be represented by, depending on different states (selected, hovered over, ...)

    In my Seamilar plugin I used following approach to draw custom colored polygons:
    https://developers.maxon.net/?p=355
    The color is decided from which UV island the mesh polygon belongs to, where each island has its own color definition.



  • On 16/11/2017 at 01:23, xxxxxxxx wrote:

    Thanks for your answer.
    So the only way is to draw above? It's kinda sad that we can't hook object Draw method (but wich can be understandable also.)

    Anyway thanks for confirming.



  • On 16/11/2017 at 01:57, xxxxxxxx wrote:

    Hello,

    as C4DS pointed out, Polygons do not have a color.

    But you can draw something in the viewport over a given object or polygon to "color" it. One way would be to implement the "Draw" function of either a ToolData or SceneHookData plugin.

    Another way to control how an object is displayed in the viewport is to implement "DisplayControl" of a ToolData or SceneHookData plugin. This also lets you define the vertex or polygon vertex colors of a given object (see ControlDisplayStruct).

    best wishes,
    Sebastian


Log in to reply