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. Rage
    3. Topics
    R
    • Profile
    • Following 0
    • Followers 0
    • Topics 17
    • Posts 27
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by Rage

    • R

      Buttons ids

      Cinema 4D SDK
      • python • • Rage
      2
      0
      Votes
      2
      Posts
      742
      Views

      ManuelM

      Hello,

      there's no real list where you can find easily those IDs.

      @m_adam came with this idea :
      open the Script log (menu script > script log) and click the button you want to call.
      in the console you will see something like

      c4d.CallButton(tool(), c4d.MDATA_NEWTRANSFORM)

      so you know that the ID is c4d.MDATA_NEWTRANSFORM

      Another place to look for, is the folder ressource/modules where you can find the files .res that build the ui. (using your OS search function will help a lot) Openning those file you will find the information

      BUTTON MDATA_NEWTRANSFORM { FIT_H; }

      and you can maybe open the file with the same name with the extention .h where you will find the id

      MDATA_NEWTRANSFORM = 701, // Button

      Other than that, there are the enums on the documentation like this page but it's not really "user friendly"

      Let me know.

      Cheers
      Manuel

    • R

      Triangulate geometry when exporting a fbx

      Cinema 4D SDK
      • r20 python • • Rage
      2
      0
      Votes
      2
      Posts
      765
      Views

      M

      Hi @Rage, I think this question is related to the another topic you posted, so I will not explain again how import/export works in CInema 4D.

      In your case, you have to use FBXEXPORT_TRIANGULATE and not FBXEXPORT_TRIANGULATE_GEOMETRY.
      And yes you are right, currently, no symbol is defined for the FBX exporter so you have to use 1026370 directly.

      Cheers,
      Maxime.

    • R

      Set options when importing a file

      Cinema 4D SDK
      • r20 python • • Rage
      2
      0
      Votes
      2
      Posts
      663
      Views

      M

      Hi @rage, you first have to configure the exporter plugin then Load the document/ Merge it.
      Cinema 4D will automatically use the settings you defined in the plugin.
      You can find examples of the procedure in our github repository.

      Finally, symbols for supported exporter/importer are exposed in this page of the Python documentation.
      Unfortunately, there is no area describing each symbol for each exporter in the python documentation, but you can find them using the search engine in the C++ documentation. (I linked you the C++ symbols of OBJ, import)

      If you have any questions, please let me know.
      Cheers,
      Maxime.

    • R

      How to set project scale

      General Talk
      • r20 python • • Rage
      6
      0
      Votes
      6
      Posts
      2.3k
      Views

      r_giganteR

      @Rage if you're looking for a solution where the user is not involved, stick to the first answer where no CallButton() was considered.
      On the contrary using it will request the user to interact since there are no means to programmatically interact with the UI or scripting users' actions on the UI.

      Best, Riccardo

    • R

      Tag not in sync

      Cinema 4D SDK
      • r20 python • • Rage
      5
      0
      Votes
      5
      Posts
      1.5k
      Views

      r_giganteR

      Hi Rage, thanks for reaching us.

      With regard to the issue mentioned and considering your non-Cinema background, first of all lets settle down a few concepts:

      UVWTags are just acting as "storage" for the UVW data used on polygonal objects; TextureTags are instead used to create the actual texturing on the on a generic object (whatever it's a polygonal or parametric one)

      A parametric object can use a texture even without explicit an UVWTag since the TextureTag delivers all the information with regard on how to map a texture to the object.

      When a parametric object (e.g. cube) is converted into a polygonal one the UVW values which are part of the parametric object gets dumped in the UVWTag that is generated as soon as the conversion ends.

      That said give a certain object (a polygonal one) the way to go is:

      def main(): # check that an object is selected if op is None: return # get the active material activeMat = doc.GetActiveMaterial() if activeMat is None: return # instantiate a TextureTag sph50NoTileTextureTag = c4d.TextureTag() if sph50NoTileTextureTag is None: return # set the mapping type sph50NoTileTextureTag[c4d.TEXTURETAG_PROJECTION] = c4d.TEXTURETAG_PROJECTION_SPHERICAL # turn off tiling sph50NoTileTextureTag[c4d.TEXTURETAG_TILE] = False # scale the mapping to 50% on u and v sph50NoTileTextureTag[c4d.TEXTURETAG_LENGTHX] = 0.5 sph50NoTileTextureTag[c4d.TEXTURETAG_LENGTHY] = 0.5 # link to the active material sph50NoTileTextureTag[c4d.TEXTURETAG_MATERIAL] = activeMat # generate the corresponding UVWTag using the mapping settings specific in the TextureTag sph50NoTileUVWTag = c4d.utils.GenerateUVW(op, op.GetMg(), sph50NoTileTextureTag, op.GetMg()) # check for UVWtag being properly created if sph50NoTileUVWTag is None: return # set the name of the tag sph50NoTileUVWTag.SetName('0.5 non-tiled spherical') # add both the UVWTag and the TextureTag if op.GetTag(c4d.Tuvw) is None: op.InsertTag(sph50NoTileUVWTag) if op.GetTag(c4d.Ttexture) is None: op.InsertTag(sph50NoTileTextureTag) # notify Cinema about the changes c4d.EventAdd()

      Best, Riccardo

    • R

      SetDocumentData options for exporting

      Cinema 4D SDK
      • r20 python • • Rage
      4
      0
      Votes
      4
      Posts
      1.2k
      Views

      M

      Hi @Rage

      I guess export_OBJ example on our Github repository is what you are looking for.
      Note for the moment values of the BaseContainer are not available in the Python Documentation.
      But you could find them in the C++ documentation about fobjexport2.h.

      If you have any question please let me know.
      Cheers,
      Maxime.

    • R

      No fbx exporter in python library?

      Cinema 4D SDK
      • r20 python • • Rage
      2
      0
      Votes
      2
      Posts
      941
      Views

      Y

      Hi Rage,

      Unfortunately several importers and exporters do not have a constant for their ID. This is the case for FBX.
      The ID for the FBX exporter is 1026370.

      To find the ID of a specific exporter you can use the following code:

      import c4d saverPlugs = c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_SCENESAVER, True) for plug in saverPlugs: print('{} : {}'.format(plug.GetName(), plug.GetID()))

      I turned the topic into a Q&A. Please remind to use this feature of the forum.

    • R

      Print console logs in terminal

      Cinema 4D SDK
      • python r20 • • Rage
      5
      0
      Votes
      5
      Posts
      2.0k
      Views

      Y

      Hi,

      As I turned this discussion into a Q&A topic, if you're satisfied with my last post's solution then you can mark it as the correct answer or mark the topic as solved.
      For more information see Q&A New Functionality.

    • R

      How to use c4d.utils.PolygonReduction

      Cinema 4D SDK
      • r19 python • • Rage
      5
      0
      Votes
      5
      Posts
      1.6k
      Views

      R

      Thank you! This is so much clear now

    • R

      Change plugin folder cinema4d R19

      Cinema 4D SDK
      • r19 python • • Rage
      2
      0
      Votes
      2
      Posts
      1.4k
      Views

      a_blockA

      Hi,

      I have turned your thread into a question, see Q&A New Functionality.
      Also moved the thread to the category Cinema 4D Development.

      In Cinema 4D R19 you can use the environment variable C4D_PLUGINS_DIR to set another path for plugins.
      It may even contain multiple directories (separated by semicolon ; ), although there was a bug in the early versions of R19, which prevented this. The bug was fixed with R19 SP2.
      There's an old thread discussing this, where you can also see how it's used: C4D_PLUGINS_DIR Multiple path
      Admittedly the original poster still seemed to have issues with mutiple paths, which we have not been able to reproduce, though.

      In Cinema 4D R20 this was changed completely. There you have multiple options:

      Multiple plugin directories can be set in Cinema's preferences g_additionalModulePath environment variable Additional plugin directories can be specified on command line Cinema4D.exe g_additionalModulePath=...

      See also Environment Variables in the user help and also the thread Is C4D_PLUGINS_DIR env var still working (R20.0.28)?.

      Cheers,
      Andreas

    • R

      Modular plugin programming

      General Talk
      • python • • Rage
      6
      0
      Votes
      6
      Posts
      2.3k
      Views

      S

      Hello,

      you might have to add the pyp file path to the system path using:

      sys.path.append(os.path.dirname(__file__))

      so

      import sys import os sys.path.append(os.path.dirname(__file__)) import hello_function

      best wishes,
      Sebastian

    • R

      Move an object in hierarchy

      Cinema 4D SDK
      • python • • Rage
      4
      0
      Votes
      4
      Posts
      1.8k
      Views

      a_blockA

      Hi,

      both answers already provide valid solutions. Nice.

      @Rage: Please also consider to use the tagging system (see Read Before Posting) and the Question and Answer feature (see Q&A New Functionality). Especially the tags can help, like for example in this case @mp5gosu would probably have provided you with Python code, if the respective tag was set.
      Besides setting tags and changing into a question, I have also moved this thread into the Cinema 4D Development category.

      And then I want to add a few links to Python docs:
      GeListNode
      CallCommand()

      Cheers,
      Andreas

    • R

      Run python script at cinema4d opening

      Cinema 4D SDK
      • • • Rage
      2
      0
      Votes
      2
      Posts
      3.2k
      Views

      a_blockA

      Hi,

      first I'd like to ask you to please add tags to your threads, see Read Before Posting. For example I'm not sure for which version of Cinema 4D you are asking.
      I have moved your thread to the "Cinema 4D Development" category.
      I also changed your thread into a question, see Q&A New Functionality.

      There are actually a few ways to achieve this.

      In all of the following cases, please note, in Script Manager scripts, there are a few predefined global variables (e.g. doc for the active document or op for the active object) you may be using. In the following solutions, these are not available. There even may be no active document (depending on the startup state of Cinema 4D), so you most likely will need load the document via LoadDocument().

      You could write your script as a plugin without an actual plugin... I mean, you'll write your code in a "my_plugin.pyp" (except for the suffix, the name is arbitrary) file inside of Cinema 4D's plugins folder, but instead of registering an actual plugin class (like e.g. CommandData), you can just implement PluginMessage() and have your code run for example on C4DPL_PROGRAM_STARTED.

      A bit elaborate may be to implement a small plugin, that adds a command line option to run a Python script via command line.
      This could roughly look like so:

      import sys, ntpath import c4d # Executes a given Python script # Syntax: cinema4d.exe "-runpy script param" def CommandRunPy(arg): # Parse arguments argComponents = arg.split(' ') script = argComponents[1] param = argComponents[2] # If file exists, execute the script if ntpath.isfile(script) is False: return # NOTE: execfile runs the script in this context, # all variables available in this scope can be used inside of the script # In this case, we may use param inside the script execfile(script) def ParseCommandline(argv): for arg in argv: if arg.find("-runpy") == 0: CommandRunPy(arg) def PluginMessage(id, data): if id == c4d.C4DPL_COMMANDLINEARGS: # Extend command line parsing, here # This is the last plugin message on Cinema 4D's start process ParseCommandline(sys.argv) return True

      A third option may be to add to a Python init script. This has changed in version R20. See R20 Startup script location - python_init.py.

      Cheers,
      Andreas

    • R

      c4dpy not working on OS x 10.12

      Cinema 4D SDK
      • python • • Rage
      5
      0
      Votes
      5
      Posts
      1.6k
      Views

      Y

      Note c4dpy does not work with a R20 free educational license. But c4dpy runs fine with a paid R20 student license.