Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Python generator - Culling issue

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 342 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 14/03/2017 at 10:16, xxxxxxxx wrote:

      Hi everyone,

      I'm experiencing some strange behaviour where polygons generated from a Python generator (this can also be replicated in an objectData plugin context) are disappearing from the viewport. This only occurs when the coordinate of the generator object cannot be seen in the viewport. This applies for Polygons but not primitives. Here's an example:

      import c4d
      from c4d import utils as u, Matrix as m, Vector as v
        
      w = 200
      h = 200
        
      off = v(1000,0,0)
        
      def main() :
          pol = c4d.BaseObject(c4d.Opolygon)
          pol.ResizeObject(4,1)
          pol.SetPoint(0,v(-w,0,-h)+off)
          pol.SetPoint(1,v( w,0,-h)+off)
          pol.SetPoint(2,v( w,0, h)+off)
          pol.SetPoint(3,v(-w,0, h)+off)
        
          pol.SetPolygon(0,c4d.CPolygon(0,1,2,3))
          
          null = c4d.BaseObject(c4d.Onull)
          
          null.SetName("PIP - Group")
          pol.InsertUnderLast(null)
          
          cube = c4d.BaseObject(c4d.Ocube)
          cube.SetAbsPos(-off)
          cube.InsertUnderLast(null)
          
          
          return null
      

      In this case, the origin is the vector where the Python Generator is located in space. If I move the camera so that the Polygon is visible but the origin is not, the polygon disappears. If I have the primitive cube in shot but not the origin, the cube still displays properly.

      Can anyone shed any light on this? Is there a camera culling feature I don't know about or something

      Thanks  🙂

      Adam

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 15/03/2017 at 02:53, xxxxxxxx wrote:

        Hi Adam,

        like shown in the Py-RoundedTube example you need to send a MSG_UPDATE ( pol.Message (c4d.MSG_UPDATE) ) to the PolygonObject after its construction, so it can update its bounding box. Unfortunately this is mentioned in documentation for the PointObject, only. Something we definitely should improve.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 15/03/2017 at 03:49, xxxxxxxx wrote:

          Thanks! I'm really glad it was that simple. 🙂

          Adam

          1 Reply Last reply Reply Quote 0
          • First post
            Last post