• How to set project scale

    General Talk r20 python
    6
    0 Votes
    6 Posts
    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
  • 0 Votes
    7 Posts
    2k Views
    K
    Thank you very much guys! I think that plugin will be better solution then script in this case. Cheers
  • Tag not in sync

    Cinema 4D SDK r20 python
    5
    0 Votes
    5 Posts
    2k 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
  • Object Generator Plugin With Dynamic Objects

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    784 Views
    S
    Hello, GetVirtualObjects() is called when the scene is updated. ExecutePasses() updates the scene. So you want to update the scene while the scene is updated. That's bad. Also, you create a virtual cube and add a tag to that cube. But you do not add the cube to any document. So updating any document would have no effect on that cube. Typically, one does not add a simulation tag to a virtual object. Such a tag is typically added to the generator that create the virtual objects e.g. you add a simulation tag to a MoGraph cloner to animate it virtual child objects. best wishes, Sebastian
  • PoseMorph Tag question

    Cinema 4D SDK
    5
    1
    0 Votes
    5 Posts
    2k Views
    M
    The mode specifies how data can be read from the Morph Tag. By default, they are presented in a compact way (aka only modified points are stored for some internal optimization). But if you SetMode with c4d.CAMORPH_MODE_FLAGS_ALL | c4d.CAMORPH_MODE_FLAGS_EXPAND then all the points are then readable from outside of the morph Tag. I adapted the Python documentation to match the C++ documentation so it will be available in the next documentation update. But I would say the C++ documentation for SetMode is pretty self-explanatory, what is the part you don't understand? Cheers, Maxime.
  • Global to Local pos

    Cinema 4D SDK python
    9
    0 Votes
    9 Posts
    2k Views
    Passion3DP
    Thank you @mp5gosu This is exactly what I was looking for. In fact, C4D does the calculations itself. I thought I had to do the matrix multiplication, and I didn't understand how to do it. Finally it's very simple
  • Bug: Constantly updating coordinates

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    546 Views
    M
    Hi @merkvilson, Actually, the issue came from inserting the matrix as a child of the cached spline. The cached spline gets a rotation of X then you apply again the rotation of the generator, which make X+X rotation. In order to avoid that, return one null with both object. def GetVirtualObjects(self, op, hh): if not op.GetDown(): return None gch = op.GetAndCheckHierarchyClone(hh, op.GetDown(), c4d.HIERARCHYCLONEFLAGS_ASIS, False) output = gch["clone"] gchDirty = gch["dirty"] if not gchDirty: return output null = c4d.BaseObject(c4d.Onull) indexView = c4d.BaseObject(1018545) output.InsertUnder(null) indexView.InsertUnder(null) indexView[c4d.ID_MG_MOTIONGENERATOR_MODE] = 0 indexView[c4d.MG_OBJECT_LINK] = output return null If you have any questions, please let me know. Cheers, Maxime
  • Time Limit for MSG_DESCRIPTION_CHECKUPDATE

    Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    1k Views
    S
    Hello, the message MSG_DESCRIPTION_USERINTERACTION_END has no data. You could store the old value of the parameter in question and check if that value has changed. best wishes, Sebastian
  • Prevent Editable Command

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    573 Views
    r_giganteR
    Hi merkvilson, thanks for reaching us. With regard to your question, current Cinema 4D API doesn't deliver the desired behavior. Best, Riccardo
  • Change Hair preferences with Python API

    Cinema 4D SDK python r20
    3
    0 Votes
    3 Posts
    994 Views
    merkvilsonM
    @mikeudin We all have to learn C++
  • Register Plugin during runtime

    Cinema 4D SDK python r20 windows
    3
    0 Votes
    3 Posts
    775 Views
    B
    Ok, thanks Riccardo! I'll register them at the start then.
  • Setting window

    Cinema 4D SDK python
    7
    0 Votes
    7 Posts
    2k Views
    Passion3DP
    Thanks @Andreas I watched Py-LiquidPainter, but I did not really understand That said, for the parameters, I understood how to do
  • Bitmap Button

    Cinema 4D SDK python
    14
    1
    0 Votes
    14 Posts
    3k Views
    merkvilsonM
    This goes off topic so I'll make a new post. The main issue is already solved, thanks to Sebastian!
  • Get PluginID from within CommandData plugin

    Cinema 4D SDK python r20 windows
    4
    0 Votes
    4 Posts
    1k Views
    B
    I am trying to register multiple plugins that are instances of the same class, but do slightly different stuff (in this case construct different menus). I am getting some external data that I would like to put in a dictionary with the plugin ID as keys. I could then get the correct data set for each plugin by comparing the pluginID from e.g. within execute with the pluginIDs in the dictionary. But for that I would need a way to retrieve the pluginID of the class instance whose execute function was called. Edit: I figured out a way. I can pass the pluginID when initializing the plugin in the register function and save it as a class member in __init__
  • Python: Selection tag

    Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    2k Views
    a_blockA
    Hi, while I'm glad, this was already solved, I just wanted to add a link to an old thread in the archive, which might be helpful for future readers due the contained code snippet: Select polygons from Selection Tag. Cheers, Andreas
  • Parameters for commandData Plugin

    Cinema 4D SDK python r20 windows
    3
    0 Votes
    3 Posts
    655 Views
    B
    Hi Sebastian! Thanks for your answer. I was looking for something a little more flexible than registering multiple plugins, but I guess GetSubContainer will have to do
  • Alternative menu for plugins

    Cinema 4D SDK
    6
    0 Votes
    6 Posts
    1k Views
    M
    Hi @merkvilson, sadly this is not possible to add something to the attribute manager, since the attribute manager is a special window, and the menu is hardcoded. Sorry. Cheers, Maxime.
  • CommandData plugin with a res dialog

    Cinema 4D SDK python r20
    11
    0 Votes
    11 Posts
    2k Views
    S
    Hello, yes, you can use resource files to define the dialog layout. Or combine layout files and code. def CreateLayout(self): self.SetTitle("Dialog Test") # load dialog from resource file if self.LoadDialogResource(10000, None, 0) == False: return False # set a different title self.SetTitle("New Title") # disable a GUI element self.Enable(10001, False) return True See GeDialog Manual and Layout files. best wishes, Sebastian
  • Dynamically changing icons

    Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    2k Views
    merkvilsonM
    Ok Thanks
  • R19 Python Multipass (Arnold)

    Moved Cinema 4D SDK
    7
    0 Votes
    7 Posts
    2k Views
    D
    Hi Riccardo, I spoke with SolidAngle. Eventhough the problem has nothing to do with Arnold, they helped us to solve the issue. There is a different behavior on Python when using BaseBitmap and MultipassBitmap for multiple renders. We render thousands of elements from the object tree in C4D. When you reuse a BaseBitmap the depth information will be saved for every element. However when you do the same with a MultipassBitmap, it will only store the depth information for the first element. Strangely this does not apply to the beauty image. The solution is simple. We set up a new MultipassBitmap for every render call. In hindsight, we should have initiated a new bitmap even for the BaseBitmap. Thank you for time, David