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
    • Recent
    • Tags
    • Users
    • Login

    Distributing class instance indices

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 643 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 01/05/2015 at 05:41, xxxxxxxx wrote:

      Hi all,

      Just for the sake of clarity another thread...
      Is it possible to set a range of hexadecimal indices for class instances and distribute respectively overwrite the content myself?

      Thanks for any help in advance
      Martin

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

        On 04/05/2015 at 01:39, xxxxxxxx wrote:

        Hi Martin,

        I'm afraid you need to give us some more info. Even after discussing with Sebastian, we have no idea, what you are after. Sorry.

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

          On 04/05/2015 at 03:05, xxxxxxxx wrote:

          Hi Andreas,

          I´m not quite sure if I understand the class-index concept the right way.
          Cinema4d builds an index for every object instance and I thought about accessing these instances through this index.
          For example, when my plugin becomes active, it occupies a set of indices in c4d which I can assign to several types of subclasses. For example, every conifer type subclass instance has an index with a 4000 in it, every broadleaf with 400 and so on.
          Later on I want to access the types by calling indices.

          Best wishes
          Martin

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

            On 04/05/2015 at 17:23, xxxxxxxx wrote:

            Hi Martin,

            Andreas is away at FMX this week, so I'm filling in on this topic.  I have a rough idea what you're asking about, but could you please post some example code that accesses the data you're discussing?  It would probably give me a clue as to where to search in the code to give you a solid answer.

            Thanks,

            Joey Gaspe
            SDK Support Engineer

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

              On 05/05/2015 at 03:11, xxxxxxxx wrote:

              Hi Joey,

              thanks for your help!
              To keep it simple, I wrote a small pseudo code.
              At the validation point inside the Plant class c4d assigns a hexadecimal index to the instances.
              I want to assign those indices by myself according to their position in space, age and other attributes,
              in order to store them in a hyperfile.
              Later on I want to access the hyperfile and modify the Instances.
              For example bend them if the wind is blowing from the west, that the "west plants" are more influenced.

              Hope you can catch the drift?
              Please let me know if you need more information.

              Thanks in advance
              Martin

              #______________________________________
              Pseudocode plant distribution:

              Plantclass:
              def init: with plant specific attributes(e.g. index, is valid, place to be, next possible places[npp])
              def TestSpace() :
               return if plant is placed or not valid
               testing the next possible places to live in
               for next possible places:
                   if place is valid:
                       place actual plant
                       built Plantclass instances for next possible places            
                       instance.TestSpace() #recursively call  
               
              Forestclass:
              placedplants = []
              def init:     with calling TestSpace from a certain start point plant.
                    with calling Collect(start point plant)
                           
              def Collect(self,spp) :
                if plant is placed:
                    Forestclass.placedplants.append(plant)
                for n in spp.npp:
                    if n != None:
                        Forestclass.Collect(n)#recursively call

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

                On 11/05/2015 at 09:06, xxxxxxxx wrote:

                Hi Martin,

                this makes me feel bad... I (or actually we, as we discussed this in our team) still don't get it. For example I'm not sure, where Plantclass gets derived from and who's calling init... I'm not aware of a situation, where C4D assigns any indeces. But this may be due to a lack of knowledge on my side.

                If it makes it easier in any way, you may also contact e via PM in German. We can then wrap this up for the forum community in the end.

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

                  On 11/05/2015 at 12:48, xxxxxxxx wrote:

                  Hi Andreas,

                  thanks for caring.
                  I´ll send a PM after my holidays.

                  Best wishes
                  Martin

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