Sketch Mat Python Modifier and Cloners/Emitters



  • On 07/07/2018 at 06:11, xxxxxxxx wrote:

    Hi,

    is there a way to directly access the actual object in the Sketch Mat's "Python" modifier? When using a Cloner or an Emitter the "op" variable holds a pointer to the parent  Cloner or the parent   Emitter ( at two different addresses for some reason) instead pointing to the actual clone/ particle object. Naturally "Render Instances" is disabled in the _Emitter/ Cloner  _settings.

    Maybe a bug/ oversight? Still with R16 here.

    Unrelated: Are there some simple examples how to use those extra commands/ attributes (PolyHit, ObjLeft, LineEnd, LineStart, etc.) exactly? I'm somewhat in the dark trying to figure out how to make any use of this stuff. Looking up any of the names in the SDK documentation results in no hits and C4D's own help isn't much useful here either.



  • On 09/07/2018 at 05:24, xxxxxxxx wrote:

    Hi tokai,

    I'm not sure to understand what you want to achieve. Do you want to identify each clone within a cloner in order to assign a different color or something like that?
    At least the fact op, return the cloner is something expected.

    Regarding your question about the difference addresses about the same object, it's normal, since everything in python return a reference to a C++ object (it's how python work, mostly by reference)
    So you get many references which point to the same C++ Object.

    Regarding variable and documentation about python Sketch and Toon sadly there is no documentation done and there is no example about them. Definitely, something we need to improve.
    PolyHit = the polygon ID hit by the ray
    ObjLeft = the left boundaries of the object similar to https://developers.maxon.net/docs/Cinema4DCPPSDK/html/struct_ray_parameter.html#a436c782621b03d27e4bd5468342c4eab
    LineStart/End = the start/end position of a line

    Maxime



  • On 09/07/2018 at 06:25, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I'm not sure to understand what you want to achieve. Do you want to identify each clone within a cloner in order to assign a different color or something like that?

    Yes, that would be the most simple example, but could by any kind of attribute really.

    e.g. setup a cloner, add shader or random effector to randomise the clone's colours. But using code like this just returns the display colour of the parent cloner, since "op" is the cloner not the clone:

    import c4d
      
    def main() :
        return op[c4d.ID_BASEOBJECT_COLOR]
    

    How could I find out about the actual clone (ID) to fetch the proper attribute?

    As a workaround in this case one could setup a Matrix instead a Cloner, then use a simple XPresso setup to copy the matrix data to a group of objects (basically faking a Cloner). That way things render properly at least. This is okay for small cases, but can become quickly cumbersome for more complex setups obviously just to workaround a problem during the render stage. That's why it would be nice to be able to solve it just via some quick Python code. :)

    Advanced examples could be to look up Thinking Particle's custom channels to transport custom values from a TP setup to the Sketch'n'Toon material to control the look of the lines.

    Regarding variable and documentation about python Sketch and Toon sadly there is no documentation done and there is no example about them. Definitely, something we need to improve.
    PolyHit = the polygon ID hit by the ray
    ObjLeft = the left boundaries of the object similar to https://developers.maxon.net/docs/Cinema4DCPPSDK/html/struct_ray_parameter.html#a436c782621b03d27e4bd5468342c4eab
    LineStart/End = the start/end position of a line

    Ah... those are simple globals. Got it. I was confused because it says "Commands" everywhere (in the UI and the documentation) suggesting it's functions/methods that have to be invoked.



  • On 10/07/2018 at 06:56, xxxxxxxx wrote:

    Hi Tokai,

    I'm afraid is not possible and your workaround is the only way to go.
    You can automate this by doing a generator that will generate X objects.

    Using normal shader you can display the mograph color, but it's not available for sketch and toon.

    Hope it's help, if you have any question please let me know !
    Maxime


Log in to reply