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

    Force MoData Array to update

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 429 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 10/12/2012 at 09:36, xxxxxxxx wrote:

      How would I go about forcing my MoData Array to reflect the actual cloner count? As it stands, when I change the cloner count, the Array won't update until after I click in the Object Manager, at which time, the array length comes back correct.

      I've tried adding c4d.EventAdd() and also resetting my array=[], but neither has any effect.

      My test:

      import c4d
      from c4d.modules import mograph
      #Welcome to the world of Python

      def main() :
          #ar = None
          
          op = doc.SearchObject('Cloner')           # Get cloner reference
          
          md = mograph.GeGetMoData(op)              # Get MoData on clones
          
          ar = md.GetArray(c4d.MODATA_MATRIX)       # Get array of clone matrices
          
          
          print(str(op[c4d.MG_LINEAR_COUNT]))       # Shows correct cloner count
          print('array length: ' + str(len(ar)))    # Shows incorrect array length

      Thanks,

      Jim

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 10/12/2012 at 19:03, xxxxxxxx wrote:

        To me it sounds like a priority issue.
        Either have your Expression tag object after the Cloner (lower in OM)
        And/or set the priority of the expression tag to late Generators (480+ somewhere)

        A quick test here and it worked in real time for me.

        Cheers
        Lennart

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 11/12/2012 at 06:36, xxxxxxxx wrote:

          Oh man, I'm sorry I left this bit out. Thanks Lennart for the reply, but I'm not using a tag - my code is on the Python Generator, and I haven't been able to see a way to set any priority between it and the cloner.

          I tried the function outlined here http://www.cineversity.com/wiki/Python%3A_Setting_Priorities/

          But with no avail.

          If you have any more advice that would be great.
          FYI - I'm using the Python Generator in order to get the script to run upon User Data update, which I haven't been able to do using a tag. Essentially, I haven't learned how to listen to update events yet 🙂

          Thanks,

          Jim

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 11/12/2012 at 08:07, xxxxxxxx wrote:

            Py Generator is generally meant for generating objects based on internal and/or external criteria.
            If you're not making new objects I'd think an expression tag might be a better option, as you
            can set the priority for it.
            For Py Generator you would need to get and check various cache and dirty status of external objects.
            A bit more complicated in my experience.

            Cheers
            Lennart

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 11/12/2012 at 08:59, xxxxxxxx wrote:

              Thanks Lennart.
              I am generating objects, so I'll take a look at that further.

              Jim

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