So, to be clear, in the end I need an user to interact and I can't do it in scripting? Can I access the dialog, somehow?
Posts made by Rage
-
RE: How to set project scale
-
RE: How to set project scale
Thanks @r_gigante for your reply
What if I want to scale the project using the "Scale Project" button?
I know that I can use the CallButton() function, but I don't know how to properly set the settingsc4d.CallButton(op, c4d.DOCUMENT_SCALEDOCUMENT)
op is a baselist containing the options for the button, right? How can I set the options (current and target scale)? I searched in the c++ documentation but all I could find is the ddoc.h with a reference to it, with no description.
-
Buttons ids
Hi all,
For the python function CallButton I have to pass the id of the button I want to call. Nice, where do I find the ids for the buttons? I can't see any information/indication on the python documentation
Best,
Niccolò -
Triangulate geometry when exporting a fbx
Hi All,
I'd like to triangulate the geometry when exporting a fbx from python. I've been searching the documentation for the id for the "triangulate geometry" option, but it looks like there's nothing about it. Also, the fbx exporter has no id like the others. For example the object export is c4d. FORMAT_OBJ2EXPORT while the fbx export is 1026370
Here's a piece of my script
container = c4d.plugins.GetWorldPluginData(1026370) for id, value in container: if id == c4d.FBXEXPORT_TRIANGULATE_GEOMETRY: container[id] = 1 ...
-
Set options when importing a file
Hi All,
I've been searching the python documentation but I've found no way to set the options when loading a 3d file. The functions LoadFile() and LoadDocument() don't seem to allow you to set settings such as "Flip z axis" or "swap X and Y axes" which are available, as instance, when importing an obj
Then, how can I set the settings displayed in the gui when importing a file?
-
How to set project scale
Hi All,
I'm trying to figure out how to change the Project scale and type (centimeters, meters etc etc) through python.
I think I've to use the UnitScale class, but the documentation is a bit unclear about this class
Reference:
https://developers.maxon.net/docs/py/2023_2/modules/c4d/CustomDataType/UnitScaleData/index.html#c4d.UnitScaleDataAny help?
-
RE: Tag not in sync
It seems like it has a projection.
Please note that I don't know c4d, I'm just coding with the api but I don't know the software itself (I came from the blender's world)
Anyways, If you go to the UV edit, and you select your object and UVW tag, you can choose the UV mapping - Projection
let me attach a screenshot of what I'm trying to access. On the bottom right you can see there are some projections types, how do I set those through python?
-
Tag not in sync
Hi All,
I'm trying to create a new UVWTag (if an object doesn't already have one). Here's my basic code:
def main():
obj = doc.GetFirstObject()if obj.GetTag(c4d.Tuvw) is None: tag = obj.MakeTag(c4d.Tuvw) tag[c4d.TEXTURETAG_PROJECTION]=3 tag.SetName('Cubic_map') c4d.EventAdd()
The code runs howewer, cinema reports the following error later when trying to access the uv:
A problem with this project has been detected: Object "Cube" - Tag 5671 not in sync. Please save and contact MAXON Support with a description of the last used commands, actions or plugins.
What Am I missing?
-
RE: SetDocumentData options for exporting
Hi @m_adam ,
Let me give you more details.
I'm writing a plugin that processes the geometry of each object in a scene. After processing the geometry I want to export the file as obj and mtl. I followed the documentation to do this last part (linked in the first post) but the mtl is not exporting. On the other hand, on another machine, the mtl gets exported.If you go to file->export->obj , after selecting the path to export to, you will see that a list of parameters pops up. In one of these parameters you can set to export or to don't export the materials. For some reasons, when I run the plugin, on my computer the material is not exported. How can I set this property and all the others that pop up in this dialog?
-
SetDocumentData options for exporting
Hi everyone,
I'm struggling to find the options (like the ones visible in the gui, export materials/flip z axis and so on) in the python documentation.
SaveDocument takes a base document as parameter and I set its settings using SetDocumentData that points to this list of settings:
[https://developers.maxon.net/docs/Cinema4DPythonSDK/html/consts/DOCUMENTSETTINGS.html](link url)
I don't see all the options I can see in the gui. How do I set them?
-
No fbx exporter in python library?
Hi all,
I'm trying to export a file to fbx format, I'm using R20. On the graphic user interface there's the option to export as fbx format, while, on the python documentation there's not.
Here's the reference:What am I missing?
-
RE: Print console logs in terminal
Thank you this works nicecly
I'm using cinema 4D 20 student edition
-
Print console logs in terminal
Hi all,
I'm developing an application that runs a python plugin in cinema4d from commandline. Here's the problem: I can't see the console prints. How do I make c4d to print the logs in the terminal console instead of its own (the internal one under script->console)?
-
RE: How to use c4d.utils.PolygonReduction
Thank you! This is so much clear now
-
RE: How to use c4d.utils.PolygonReduction
Thank you y_puech
Would you be so kindly to explain me the difference between a BaseObject, a PolygonObject and a PointObject? Honestly I don't think the python documentation is really clear
Consider that I'm new to cinema4d (I'm from the blender's world)
-
How to use c4d.utils.PolygonReduction
Hi all,
I'm struggling to understand how does the polygon reduction works. The manual provides a sample code:
https://developers.maxon.net/docs/py/2023_2/manuals/manual_polygonreduction.htmlI tried to run this one, but I get the following error:
StandardError: The dictionary must contain a valid polygonal BaseObject (_op dictionary entry)I understand this error: I'm providing the wrong object type (https://developers.maxon.net/docs/py/2023_2/types/objects.html). I think I have to convert the object to PolygonObject, am I right? If so, how do I do that?
-
RE: Modular plugin programming
Thanks
Any hint why the hello world code I wrote is not working?
-
RE: Modular plugin programming
Let me share you an example.
This is a simple hello world program.
In 'hello.pyp' I have (how do I format the text to code?):import c4d import sys import hello_function def PluginMessage(id, data): if id==c4d.C4DPL_COMMANDLINEARGS: hello_function.say('Hello World') return True return False
In 'hello_function.py' I have:
def say(word): print(word)
When I run this from commandline, in the console I get the error that the hello_function package has not being found. They're on the same folder. I don't see any reason why this is not working