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

    Texture Weirdness (size issue?)

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 657 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 21/08/2017 at 08:31, xxxxxxxx wrote:

      I have a weird problem with a texture:

      _<_img src="http://35.io/media/c4d.png" height="932" width="1920" border="0" /_>_

      I think I can solve this problem in my plugin by combining those 256 "chunks" (MCNK #xxx) into ONE geometry instead of combining them with a connect object and then run the smoother (subdiv) over ONE object instead of the result from the combiner because that seems to actually work...

      So the question would be:
      Is there a ModelingCommand I can use in Python that does the same as the Connect+Delete command or do I have to do a

      c4d.CallCommand(16768)
      

      For some reason, I don't really like calling UI command from a script, that just seems kinda cheety...

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

        On 21/08/2017 at 09:21, xxxxxxxx wrote:

        You don't call UI commands. You call commands that can also be called from UI. These commands exist for a reason. They save you a lot of work.

        Of course you can also assemble these objects by yourself. But why would you want to do that since the command already exists and you don't want to do some fancy stuff while connecting?

        A typical method to imitate Connect+Delete would go like:
        Get selected objects.
        Get first object in the list, hold it as parent for others.
        Iterate to the next one, get all polies, copy them to the parent object.
        etc.
        etc.
        Optimize.
        Delete all objects that aren't used anymore.
        Update parent object
        Update document.

        And of course, there's also some error-checking and Undo involved that has to be implemented by yourself.

        All this stuff can be done with a single command that someone has already written for you.

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

          On 21/08/2017 at 11:18, xxxxxxxx wrote:

          Ok, so I'm doing this:

            
          c4d.CallCommand(100004767) # Deselect All  
          obj.SetBit(c4d.BIT_ACTIVE) # Select current object (obj is the parent NULL of all chunks)  
          c4d.CallCommand(100004768) # select all children  
          c4d.CallCommand(16768) # connect & delete  
          c4d.EventAdd()  
          

          The weird thing now is: The new object (combined) is not in the place of the "old" one" (it is at the document root) and the old subobjects are not being deleted...

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

            On 21/08/2017 at 11:55, xxxxxxxx wrote:

            I can work around this with...

              
                  # connect & delete and then optimize (convoluted amount of steps.... urgh...)  
                  c4d.CallCommand(100004767) #Deselect All  
                  obj.SetBit(c4d.BIT_ACTIVE) # Select current object  
                  name = obj.GetName()  
                  c4d.CallCommand(100004768) # select all children  
                  c4d.CallCommand(16768) # connect & delete  
                  nobj = doc.GetFirstObject()  
                  nobj.InsertUnder(subparent)  
                  sobj = nobj.GetNext()  
                  sobj.Remove()  
                  nobj.SetName(name)  
                  c4d.EventAdd()  
            

            but that just seems way too complicated...

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

              On 22/08/2017 at 02:16, xxxxxxxx wrote:

              Hello,

              I just want to confirm that there is no modelling command corresponding to the "Connect Objects + Delete" function.

              Using CallCommand() is perfectly fine. But be aware that using CallCommand() is the same as pressing the the corresponding button in the UI. This means the command invoked with CallCommand() will do its own undo-handling etc.

              best wishes,
              Sebastian

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