Thanks @m_magalhaes for looking it up, and writing a workaround, much appreciated!
Posts made by orestiskon
-
RE: How to get Redshift material assignments
-
How to get Redshift material assignments
Hello,
I'm trying to get the material assignments for Redshift materials but I'm getting inconsistent results.The code is:
material = doc.GetFirstMaterial() while material: assignment_list = material[c4d.ID_MATERIALASSIGNMENTS] print (material.GetName(), assignment_list.GetObjectCount()) material = material.GetNext()
Initially the assignment list shows the correct number of objects. But as soon as you interact the material, e.g. select it or rename it, then it shows 1 extra number of objects:
Not sure how should I get the correct assignment list consistently, does anyone have any ideas?
Here is an example file for convenience:
reshift_isolate.c4d -
RE: C4D Freezes after consecutive Import/Export
@orestiskon
After debugging the scene, it doesn't seem to freeze now.
I was using .replace() wrong on the savepath and it caused a conflict.Still curious if the killdocument is necessary in the end.
-
C4D Freezes after consecutive Import/Export
Hello,
I'm making a script that converts an FBX to alembic and loads it. It does it as follows:
- Load FBX file
- Export it as Alembic
- Merge the Alembic into current scene
1 and 2 work fine, but if I try to merge the .abc file then C4D freezes.
Did I fly too close to the sun with this?The code is something like:
filePath = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_SCENES, "Choose an FBX File", c4d.FILESELECT_LOAD) fbx = c4d.documents.LoadDocument(filePath, c4d.SCENEFILTER_OBJECTS) "do some operations in-between" fileFormat = c4d.FORMAT_ABCEXPORT savePath = filePath savePath.replace(".fbx", ".abc") c4d.documents.SaveDocument(fbx, savePath, c4d.SAVEDOCUMENTFLAGS_DIALOGSALLOWED | c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST | c4d.SAVEDOCUMENTFLAGS_NO_SHADERCACHE, fileFormat) "up to here it's fine, running the one below causes a freeze" c4d.documents.MergeDocument(doc, savePath, c4d.SCENEFILTER_OBJECTS)
Also, do I need to use KillDocument() for the original FBX which I loaded?
Thanks!
-
RE: Get identical document as the Render document
After more testing unfortunately there were still differences, not sure if I'm missing the proper way to go with it or if it's a limitation that the editor won't ever match the render state precisely.
-
RE: Get identical document as the Render document
I think I managed to make it work by using:
c4d.documents.LoadDocument(docPath, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)
and then going to the end of the document and rewinding back to the beginning.
Doing this on the active document didn't work.
I'm using the Render execute passes as well, and the combination of all these seem to match the render results.
-
Get identical document as the Render document
Hello,
I'm trying to create a script where I export models from the document across different frames exactly as they appear in the animated render.
However there are differences. The document is sampling a noise to drive values, and there could be minute differences between the editor document and the render document that is causing it to produce slightly different values.
Is there a way to ensure in my script that I'm using the exact same document execution that the renderer is using?
-
RE: How to check if document is rendering?
Thanks Ferdinand,
"if it does run, it runs ;)"
Haha, that's my motto.
In this case I'm doing a brute-force script for a specific 1-time use, I'm sure it won't pass the test of approval. But if I see a sign of problem I'll fall-back to other solutions.
It seems to work well and I'll keep that solution for future uses.
Thanks again. -
RE: How to check if document is rendering?
@ferdinand Hey Ferdinand, thanks for the elaborate reply.
I didn't mean to put you through all of this work, I was literally searching for an "if rendering" statement. I'm trying to use a python expression tag, and only run a line of the code if it's rendering externally (picture viewer or render queue) .
Based on your solution, I tried:
value = 10 if c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING): value = 20
and it seems to work. You mentioned that I couldn't affect other objects but I guess in this case it's ok?
-
How to check if document is rendering?
Hello everyone,
some objects like the Subdivision Surface or the Metaballs have different parameters to be applied if the document is rendering.
Is there a way in python to check if the document is currently being rendered or not, to make if/else statements that only apply during rendering?
-
RE: Python SSL error
@m_adam Thanks Maxime, I'll check that out.
The customer was using R23.110 -
RE: Python SSL error
Hi all,
is there an update on this? Some of my customers had trouble verifying their licenses and I pinpointed it to this error.
I can work around it by using this solution, which seems to create an unverified context: https://stackoverflow.com/questions/35569042/ssl-certificate-verify-failed-with-python3Is this an acceptable solution for dealing with this issue?
-
RE: Creating "Objects" on Python tag
@m_adam That clears it up, thanks Maxime!
-
RE: Arranging Objects by order of Object Manager
@m_magalhaes Hi Manuel, sorry I missed your message.
I have an Include/Exclude lists of objects, and I would like to iterate on them in a hierarchical order.
If I just go with the order of the list, the user might not have added them in the hierarchical order.Doing it in the same order they are displayed in the Object Manager is a reliable way of ordering them hierarchically, so I was looking for an efficient way of doing that.
Do you have any other ideas than iterating through all the objects of the project?
-
Creating "Objects" on Python tag
Hello,
I want to ask your opinion about how safe it is to do this on a python tag.
I want to create a minimal polygon object like thisvar = c4d.PolygonObject(3, 1)
and then read data from it, without inserting it in the scene.
Is this safe to run that on an expression at every frame?
Could this cause a memory leak? Should I delete it from the memory at the end of the expression?Also, is it necessary that I use 3 points for a PolygonObject? Could I just make it:
var = c4d.PolygonObject(1, 1)
Thanks
-
Where to find .res documentation?
Hello,
as the title says, is there a place where I can find documentation about creating .res interface files, hopefully with examples and pictures?
-
RE: Faster way of converting dict of Vector3 to Vector4
@m_adam Thanks a lot for the benchmarking Maxime. I was planning to go for the string method, I'm surprised it's not faster.
I wasn't planning to use this for a plugin, not to mention C++, but it's good information to have.
-
RE: Ways around the Python GIL
@m_adam thank you, I'll try that out and return with questions
-
RE: Ways around the Python GIL
@m_adam Hi Maxime,
sounds good, do you know of any resources or examples on getting started with something like this?