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

    Modifier dependencies

    Cinema 4D SDK
    c++ r19 r20 r21 s22
    2
    6
    910
    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.
    • rsodreR
      rsodre
      last edited by

      When a generator has dependencies that must be previously cached, we use the DependencyList APIs inside GetVirtualObjects().

      What if a modifier also has dependencies?
      Can it add more dependencies to the parent generator?
      What's the best method to guarantee that a dependency is cached?

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hi,

        just to be sure, as you can see on this page, the generator must check the dirtyness of a child to know if it need to rebuild its own cache.

        If you have multiple object you can use a dependence list.For example, GetAndCheckHierarchyClone is using it internally.

        Technically, you could use AddDependence from everywhere, but it will/could be erase right after.

        If your modifier must be sure that another object is updated, you have to do it by yourself using IsDirty/https://developers.maxon.net/docs/cpp/2023_2/class_c4_d_atom.html#a5ac82ad49ad02242398aa01ef731f524/GetHDirty

        Inside a generator you can use CheckCache.

        You probably have an idea/example where it could be necessary, could you tell us more ?

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        rsodreR 1 Reply Last reply Reply Quote 0
        • rsodreR
          rsodre @Manuel
          last edited by

          @m_magalhaes My modifier have a BaseLink that can receive polygons, which I use for various things such as collision.

          In a modifier, where is the better place to create a dependence list and check dependencies? modifyObject() or CheckDirty()

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            hi,

            Well, in that case you have no real way to be 100% sure that the cache of the linked object will be created and updated.

            CheckDirty is call more often than ModifyObject so between the two I would go with CheckDIrty
            Another function you could also use, is Execute.
            By adding it to a real late moment on the scene execution you could maybe make your deformer to update at the end (op->SetDirty())

            You could also use a Message where you can check any change on the scene and check if it's your object that have changed. (by storing it's dirtyState)

            Finally, when the link is modified or when someone drop an object you could check what kind of object it is and change the execute priority accordingly.

            I think that Execute is probably the best solution here.

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by

              hi,

              any feedback on this one ?

              Cheers,
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              rsodreR 1 Reply Last reply Reply Quote 0
              • rsodreR
                rsodre @Manuel
                last edited by

                Hi @m_magalhaes

                This was research for a feature I'll start implementing soon, and possible refactor.
                I'll mark as solved and if there's anything else I need I'll open it again.

                Thanks.

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