Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    1. Maxon Developers Forum
    2. intenditore
    3. Posts
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 34
    • Best 2
    • Controversial 0
    • Groups 0

    Posts made by intenditore

    • RE: pyDeformer mode: ID_MG_BASEEFFECTOR_POSITION works, but ID_MG_BASEEFFECTOR_SCALE doesn't

      Oh, you're always making a huge work answering the questions! 👏

      I'm slightly confused by the topic you cover, can't find what PNG is.
      What should I do with random.seed than if I rely on unique random number generated for the particular clone? I can't move it out of main() because only there ID is accessible.
      Make some class to store there those random numbers as globals and check should I generate it again or use as before based on user data seed and clone count?

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: pyDeformer mode: ID_MG_BASEEFFECTOR_POSITION works, but ID_MG_BASEEFFECTOR_SCALE doesn't

      I am a bit confused, because the integer value for the symbol in question, is right there in your print out (1011 is integer value for c4d.ID_MG_BASEEFFECTOR_SCALE
      Sorry, that's my typo of course.
      My code actually looks like this:

      import c4d
      from c4d.modules import mograph as mo
      import random
      #Welcome to the world of Python
      
      def main():
          md = mo.GeGetMoData(op)
          if md is None: return 1.0
          mode = md.GetBlendID()
          
          index = md.GetCurrentIndex()
          random.seed(md.GetCount() * index * op[c4d.ID_USERDATA,1])
          rIndex = random.randint(0,2)
          if mode == c4d.ID_MG_BASEEFFECTOR_SCALE:
              rVal = 1
          else:
              rVal = random.choice([-1, 1])
          weights = md.GetArray(c4d.MODATA_WEIGHT)
          #print rVal
          vector = c4d.Vector()
          vector[rIndex] = rVal * weights[index]
          if mode == c4d.ID_MG_BASEEFFECTOR_POSITION or mode == c4d.ID_MG_BASEEFFECTOR_ROTATION or mode == c4d.ID_MG_BASEEFFECTOR_SCALE:
              return vector
          else: return 1.0
      

      It's point is to randomly choose the axis which the value will be added to. It can give results as in attached image 2020-07-22_16-58-31.png
      But to avoid negative scale I check if the Scale is active. But weirdly my code with the same check as yours never worked. For some reason I copied your and despite it's the same letter to letter now it works.
      I'm confused...

      But thanks for your answer anyway!

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • pyDeformer mode: ID_MG_BASEEFFECTOR_POSITION works, but ID_MG_BASEEFFECTOR_SCALE doesn't

      I stumbled upon a weird thing. I code a Python Effector (parameters control), there I want to check does it affect scale parameter or not:

      md = mo.GeGetMoData(op)
      mode = md.GetBlendID()
      if mode == c4d.ID_MG_BASEEFFECTOR_SCALE:
              rVal = 1
          else:
              rVal = 0
      

      Fairly basic
      And you know, the first if is never true. Despite ID_MG_BASEEFFECTOR_POSITION is working.
      I tried ID_MG_BASEEFFECTOR_SCALE_ACTIVE but nothing changed.
      Than I checked what mode is. Whatever I do it's always returning the same:

      1010
      1011
      1012
      1013
      1013
      1013
      1065
      1066
      1067
      1064
      1068
      1069
      1020
      19
      20
      

      There are all kinds of the modes enumerations (can be found in \resource\modules\objects\description\obaseeffector.h) despite only Scale (1013) is active. So I don't understand what is that.
      Why doesn't it work? And how should it?

      posted in Cinema 4D SDK python r19 r20
      intenditoreI
      intenditore
    • RE: Get all neighboring points (including not connected by edge). Fast.

      @zipit I don't get why you're still not working in Maxon. That seems illogical!
      Many thanks for a such detailed answer once again!
      The problem is the solution is intended to chew a lot of polys and there may be some "Zbrush"-like model. So as I already understand, I will have to port it to CPP anyway.

      @nophoto said in Get all neighboring points (including not connected by edge). Fast.:

      I would use a BaseSelect to 'collect' all points

      Quite a point! Great suggestion I think, I will try that out

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • Get all neighboring points (including not connected by edge). Fast.

      Hi. My goal is simple - I need to gather info from all the points which are near a given one. I can use

      c4d.utils.Neighbor.GetPointOneRingPoints()
      

      But it's downside (for me) is it only considers the points connected to specified point by edge. I need all of which belong to the polygons this point belongs to.

      So that could be done by Utils.Neighbour, but... First you have to get neighbour polys. Than their points. Than exclude the first given point from the list and toss them all so the list doesn't contain duplicates. And only than you get the list of the points.

      On dense geometry this would increase the cyclecount and memory consumption much! I don't really like that.

      Are there any handier way to achieve the same?

      posted in Cinema 4D SDK python
      intenditoreI
      intenditore
    • RE: TagData plugin to "return" Vertex map?

      Yeah, sure)

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: TagData plugin to "return" Vertex map?

      @m_magalhaes said in TagData plugin to "return" Vertex map?:

      I don't see the benefice of creating a generator ? What's your idea ?

      actually it was another idea with the same concept behind - I wanted to make kingda "edit poly" modifier, so generator must have been behaving like a poly object. But now I see it's not possible...

      Thanks for all the help!

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: TagData plugin to "return" Vertex map?

      Oh, that's sad..
      Thanks for answers
      Does this extrapolates to all the aspects? For instance, can I make a generator/deformer which would "return" PointObject?

      Sorry I forgot tags

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • TagData plugin to "return" Vertex map?

      I'm curious and nobody yet could answer me (even Donovan Keith doesn't know) - how to make a tag which can be used as a vertex map where the usual vertex map is applicable? Yeah, you can modify an existing map for sure, but it's not the way I wish to go
      Is it possible?

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: UI, Resource Descripion and all those .h, .str, .res

      Brah... Third time spent fighting with stupid typos! :
      @PluginStudent @zipit @r_gigante many thanks! I didn't assume you are using the same system inside the program and had no thought to take a look there!
      Seems adding the "," helped it.
      And, as I see, you must enumerate all the elements in your .h file, but though you can leave id blank.
      Thank you!
      %\

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: UI, Resource Descripion and all those .h, .str, .res

      I feel stupid. You tell me the right things but even when I used semicolons and seemingly screwed it all up it all still was functioning
      Anyway, this one works
      2020-04-19_18-25-17.png

      But than I move the TXT_CREDIT to the top (changing ids accordingly!) and it gives two cycling errors relating to both .h (line 😎 and .res (line7) files

      2020-04-19_18-25-51.png

      Docs don't give an answer 😐

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: UI, Resource Descripion and all those .h, .str, .res

      I've studied those docs and couldn't get enough satisfaction 😞

      I've changed the semicolons for comas, and even deleted them all, but the error persists. I'm wondering what's happening there(

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: UI, Resource Descripion and all those .h, .str, .res

      @zipit many thanks, it worked out! But... Not for long
      Again. I only added STATICTEXT entry
      2020-04-19_15-53-02.png
      and now I get "Error reading resource file.... TautoLayer.res line 8.
      What could be wrong... So confusing!
      Nope, we still need a guide

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • UI, Resource Descripion and all those .h, .str, .res

      Despite I didn't want to ask you about that and fought much, I need help.
      Don't be offended, but Resource Descripion topic on CPP docs looks too stingy to dive into the theme and feel comfortable. The explanation makes the whole idea somehow clearer than before, but there are hidden underwater rocks around I can't identify, and the only info you can harvest is the line where the error is, but nothing about the cause. So:

      1. Isn't there a nice humanly-understandable guide into UI building with Resource description? I bet many need some better explanation than the one docs give. There are A LOT of questions - does the first id in .h "enum" must be the plugin id? Do we need to enum all the entries of .res or only the ones can call a Message()? What should be in c4d_symbols.h?..;
      2. What could be wrong in my instance? Those are my res.desc. files (ids are named for the test). It all worked nice when there was only one button, but after I simply added more it's always giving me two errors cycling (until I kill the process).
        What did I mess up?

      2020-04-19_04-28-29.png
      2020-04-19_04-28-43.png
      2020-04-19_04-29-08.png
      2020-04-19_04-29-14.png

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: Python tag - IsDirty() not working?

      @m_adam thank you, that's really confusing..

      posted in General Talk
      intenditoreI
      intenditore
    • RE: Undo for a TagData?

      I forgot about that totally...
      But maybe is there a way to catch the undo and do something before the actual undo?
      I tried to catch MSG_DESCRIPTION_INITUNDO through the Message() but it didn't work too, all I get is None

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • Undo for a TagData?

      I have a TagData Python plugin. It uses a loop to iterate all the children of the object it's applied to and changes their parameters after the hierarchy changes. All that happens in Execute().
      I tried to wrap it all with usual Start/Add/EndUndo(). But.. It doesn't work.
      I simplified the code to check how it works. So after the trigger action it simply changes the main node name.

      doc.StartUndo()
      doc.AddUndo(c4d.UNDOTYPE_CHANGE, op)
      
      op.SetName("blah")
      
      doc.EndUndo()
      c4d.EventAdd()
      

      It does not undo the name change back on user undo.
      What am I doing wrong?

      posted in Cinema 4D SDK
      intenditoreI
      intenditore
    • RE: Python tag - IsDirty() not working?

      @PluginStudent oh God! You helped me so much!
      Many thanks for that. Sincerely, it's not very well explained in docs, really not well (in opposite to Undo system for instance) and getting how exactly should it work is tricky. But your last suggestion surely works, and it raises the number every time hierarchy is changed, so I need only check has it been changed or not and than decide to run the code or not (maybe somebody will stuck in the same position so I hope my plain explanation would be useful)
      Thanks!

      posted in General Talk
      intenditoreI
      intenditore
    • RE: Python tag - IsDirty() not working?

      Yeah... I fought with this type for almost a day ;D
      But than some weirder things has been discovered.
      I have this easy code in TagData plugin:

      def Execute(self, tag, doc, op, bt, priority, flags):
      
          op.SetDirty(c4d.DIRTYFLAGS_CHILDREN)
          print op.GetDirty(c4d.DIRTYFLAGS_CHILDREN)
      

      It always prints 0, no matter what happens to the children. I also tried other model, DIRTYFLAGS_ALL - there it starts with a small random number and adds 1 every update even if nothing happens. I tried DIRTY_CHILDREN also, the same "0".
      Can't get how hierarchy change checking works. And does it?

      posted in General Talk
      intenditoreI
      intenditore
    • RE: Python tag - IsDirty() not working?

      @PluginStudent said in Python tag - IsDirty() not working?:

      IsDirty() is only relevant in the pipeline of an ObjectData generator plugin (BaseObject Manual).

      You need C4DAtom.GetDirty() or C4DAtom.GetHDirty() to compare the dirty checksums.

      I'm sorry, but I can't untangle it. I try to execute the following in the tag plugin:

      def Execute(self, tag, doc, op, bt, priority, flags):
          op.SetDirty(c4d.DIRTY_CHILDREN)
          print op.GetDirty(c4d.DIRTY_CHILDREN)
      
      AttributeError: 'c4d.BaseObject' object has no attribute 'SetDitry'
      
      posted in General Talk
      intenditoreI
      intenditore