• << Multiple Values>> in Attribute Manager

    c++ r20 sdk
    3
    0 Votes
    3 Posts
    496 Views
    D
    Thanks! That's exactly what I needed!
  • Python 3.7.7 will be in the next release of Cinema 4D

    6
    1
    0 Votes
    6 Posts
    2k Views
    ?
    I have been looking at my plugins and my biggest question so far is how to handle urllib2 in a way that will work with both Python 2.7 and 3.7.7. Everything else just seems to be adding parentheses to print functions. I found this Cheat Sheet: Writing Python 2-3 compatible code that suggests: # Python 2 and 3: easiest option from future.standard_library import install_aliases install_aliases() from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError However, trying that in Cinema 4D threw this error: ImportError: No module named future.standard_library Fortunately, there are some alternatives to try, like # Python 2 and 3: alternative 4 try: from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError except ImportError: from urlparse import urlparse from urllib import urlencode from urllib2 import urlopen, Request, HTTPError From that article: "urllib is the hardest module to use from Python 2/3 compatible code."
  • SetAllPoints() Not Working On An Object With Skin/Bind

    r21 python
    9
    0 Votes
    9 Posts
    2k Views
    B
    @m_adam Thanks for the response. RE: without enabling the Post Deformers option. It seems like so. I initially thought I could reverse engineer it by getting the point's skin influence (its joint and its weight) and in a way factor it with the intended world vector. However, I gave up since I realize point can have several joints and several weight. Haha Don't get me wrong, enabling the post deformer works as expected. The problem comes because of its inherent nature "calculate the points position of the morph after they are deformed by a Deformer." It presupposes that the (near) last deformation comes from the pose morph. For example, Squash/Stretch>Bulge>Bend>Twist>Pose Morph. However, there are cases where the intended deformation is Pose Morph>Squash/Stretch>Bulge>Bend>Twist. So having the post deformer off while still getting the world position desired gives a bit of flexibility. Anyhow, thanks again for the help. I'll just use the post deformer for now and see where I get stuck. Have a great day ahead!
  • gui.ColorDialog() offers no options

    3
    0 Votes
    3 Posts
    697 Views
    M
    And I should have opened my eyes previously, but c4d.POPUP_BELOW shouldn't be used but instead color=gui.ColorDialog(0). I will improve the python documentation n this regards, for more information see the c++ doc about GeColorChoose. So this is not a bug. Cheers, Maxime.
  • Max value of an EditNumberArrows in TagData

    s22 python
    3
    0 Votes
    3 Posts
    367 Views
    ?
    @m_adam Thanks, Maxime!
  • Mute Object Animation

    r21 python
    5
    0 Votes
    5 Posts
    478 Views
    B
    @zipit Gotcha. Thanks for the reminder
  • Best coding practices

    python
    3
    0 Votes
    3 Posts
    698 Views
    mfersaouiM
    @zipit Thank you much.
  • Close Cinema 4D with C++ plugin??

    c++ r21
    3
    0 Votes
    3 Posts
    443 Views
    J
    That is a great idea! Thank you!
  • Getting and setting frame range from RenderData

    2
    0 Votes
    2 Posts
    690 Views
    r_giganteR
    Hi @nicholas_yue thanks for reaching out us. Although I'm not sure if your post was meant as a question or as a statement I'm going, nevertheless, to share some thoughts. The data you're looking for are stored in the RenderData BaseContainer and you can set/get them using the usual method. A full exmaple is available on PluginCafe Github Repo. Put down in words the code might looks like something as: def printRDataInfo(in_rdata): # BaseTime values are printed as frame print in_rdata[c4d.RDATA_FRAMEFROM].GetFrame(doc.GetFps()) print in_rdata[c4d.RDATA_FRAMETO].GetFrame(doc.GetFps()) print in_rdata[c4d.RDATA_FRAMESTEP] # Main function def main(): # retrieve the RenderData instance rdata = doc.GetActiveRenderData() #just print the default values print "default rdata from/to/step values" printRDataInfo(rdata) # start is at sec 1 rdata[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(1) # end is at sec 2 rdata[c4d.RDATA_FRAMETO] = c4d.BaseTime(2) rdata[c4d.RDATA_FRAMESTEP] = 1 #just print again the values print "first change with values to secs" printRDataInfo(rdata) # start is at frame 5 rdata[c4d.RDATA_FRAMEFROM] = c4d.BaseTime( 5.0, doc.GetFps()) # end is at frame 15 rdata[c4d.RDATA_FRAMETO] = c4d.BaseTime( 15.0, doc.GetFps()) rdata[c4d.RDATA_FRAMESTEP] = 1 #just print again the values print "second change with values to frames" printRDataInfo(rdata) Cheers, R
  • Directory UI component ?

    2
    0 Votes
    2 Posts
    469 Views
    M
    Hi @nicholas_yue this can be done with the CUSTOMGUI_FILENAME Here a complete example import c4d class ExampleDialog(c4d.gui.GeDialog): def CreateLayout(self): """ This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog. """ settings = c4d.BaseContainer() settings[c4d.FILENAME_DIRECTORY] = True self.AddCustomGui(1000, c4d.CUSTOMGUI_FILENAME, "", c4d.BFH_SCALEFIT | c4d.BFV_CENTER, 0, 0, settings) # Creates a Ok and Cancel Button self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL) return True def Command(self, messageId, bc): """ This Method is called automatically when the user clicks on a gadget and/or changes its value this function will be called. It is also called when a string menu item is selected. :param messageId: The ID of the gadget that triggered the event. :param bc: The original message container :return: False if there was an error, otherwise True. """ # User changed the file path if messageId == 1000: print(self.GetFilename(1000)) # User click on Ok button if messageId == c4d.DLG_OK: print(self.GetFilename(1000)) return True # User click on Cancel button elif messageId == c4d.DLG_CANCEL: print("User Click on Cancel") # Close the Dialog self.Close() return True return True def main(): # Creates a new instance of the GeDialog dlg = ExampleDialog() # Opens the GeDialog, since it's open it as Modal, it block Cinema 4D dlg.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, defaultw=300, defaulth=50) if __name__ == "__main__": main() Cheers, Maxime.
  • Check for missing textures

    4
    0 Votes
    4 Posts
    984 Views
    indexofrefractionI
    hi and thanks Maxime ! GetAllAssetsNew() is S22 only, and I had problems with InitRender() and Vray Bitmaps so I decided to manually check for the files... I had it already, but GenerateTexturePath() shortens the code quite a bit, because I dont have to check all possible paths. It seem GenerateTexturePath() returns the absolute path, if the file is found somewhere in the texture paths, otherwise it returns None. needs some testing, but until now it seems to work well. best, index
  • Creating Commands for Shortcuts

    s22 python
    4
    1
    0 Votes
    4 Posts
    430 Views
    ?
    @m_adam Thank you, again, Maxime
  • Writing/Reading Rendered Image to and from Text

    python sdk
    13
    0 Votes
    13 Posts
    1k Views
    ?
    @m_adam Thank you, Maxime. I still learned a lot from your help, @zipit , thank you too.
  • Keeping text and edit UI component horizontally

    Moved
    3
    1 Votes
    3 Posts
    666 Views
    M
    Hi @nicholas_yue I confirm the correct way is to define the number of columns you want in a group. Please next time, post on the correct forum see How to post a Question, to set up tags and be sure to set up your topic as q question(QA Functionality. Cheers, Maxime.
  • Colorize plugin object icon

    python
    4
    0 Votes
    4 Posts
    783 Views
    M
    This functionality only exists since R21, for the previous versions, there is this hack that is very not recommended Plugins in plugin OR icons!!!!!. Cheers, Maxime.
  • bc lost stored mesh

    python
    6
    0 Votes
    6 Posts
    1k Views
    P
    After taking a deep dive into the documentation again i figure out that im thinking way to complicated. I use the Cache provided by cinema and write a custom check around it. This avoid using a cached mesh in a baseContainer and also removing a cinema4d breaking memoryleak in my plugin i just found. So thank you.
  • Avoid creating new field object as child from plugin

    r21 r20 python
    6
    0 Votes
    6 Posts
    1k Views
    P
    Ah sorry.
  • Post import - Updating alembic path does not update scene ?

    7
    0 Votes
    7 Posts
    2k Views
    ManuelM
    hi, I'll set this thread to solved without further feedback Cheers, Manuel
  • From Line Object to Spline

    python s22
    5
    0 Votes
    5 Posts
    1k Views
    ManuelM
    hi, I'll consider this thread as solved without further feedback Cheers, Manuel
  • Get visible objects from viewport in commandline

    11
    0 Votes
    11 Posts
    2k Views
    ManuelM
    hi, I tried creating a CommandData that you could be triggered with a parameter --> not working I tried creating a ObjectData that could react to MSG_DOCUMENTINFO in its Message function when the document is loaded --> not working I tried when the program is closing --> not working Based on my knowledge, there's no solution for your issue. Cheers, Manuel