At our facility we have PySide2 installed for python 3.9, which of course includes the shiboken2 package. However, for some reason it fails to load in either c4dpy.exe or the python console (in the C4D application). It loads just fine in the python.exe that ships with C4D R24.
ImportError: DLL load failed while importing shiboken2: The specified module could not be found.
Why might this be happening and how can we fix this? Our pipeline tools are all PySide/PySide2 based and they work without problems inside older versions of C4D such as R18, R19, R20, R21.
(And yes, the location of shiboken2 is in sys.path, as evidenced by the fact that other modules at the same level as shiboken2 import without problems.)
Platform: Windows 10
I have a python script that adds an XRef to the current document and needs to set the "Relative to Project" option to False (0) so that the reference path will be an absolute path. How do I do this?
So is there a fundamental architectural reason why Materials don't accept Tags? In other words, the InsertTag/GetTags/KillTag methods only exist on BaseObject but not BaseMaterial. Why is that?
@r_gigante Perfect! Worked like a charm. Thank you.
So I believe I managed to get this working by creating a registry key pointing to the network Houdini installation directory. Also, it seems as though the Houdini bin directory needs to be in PATH.
If there are other more subtle things I also need, please let me know. Thanks!
So at our facility we have our own (Python-coded) application launcher that launches a particular version of any given application (like C4D or Maya or whatever) based on a per-project configuration file. This launcher sets up all the necessary environment variables, bootstraps the associated Shotgun Toolkit engine (if one exists), and launches the application. All of our applications live on a central network drive and are typically licensed via floating licenses.
So the problem here is that when C4D (R21 in this case) is launched, it doesn't know about Houdini Engine even though we have it deployed to our central network server (and yes, we have the specific version/build of Houdini required for R21). This is unsurprising since we are launching C4D, not Houdini, and so none of the usual Houdini environment is set up by our launcher.
So my question is this: what environment variables do I need to set up in order for C4D to "see" (and use) Houdini Engine given that Houdini is not installed locally on user's machines? Simply adding the directory containing the network Houdini install to PATH has proven to not be sufficient.
(P.S. Apologies if this isn't the right forum to ask this. The other ones didn't seem like better choices to me.)
So once I have the BasicVideoPost object for the Redshift settings:
rdata = doc.GetActiveRenderData()
vpost = rdata.GetFirstVideoPost()
assert vpost.GetType() == 1036219
How do I access the data highlighted in red in the gui screencap below?
Querying the REDSHIFT_RENDERER_AOV_COUNT:
num_aovs = vpost[c4d.REDSHIFT_RENDERER_AOV_COUNT]
yields 3, as I would expect, but from there I don't know how to get/set the settings data for any of those three AOVs.
Update: I noticed relevant constants in vprsrenderer.h called REDSHIFT_RENDERER_AOV_LAYER_FIRST and REDSHIFT_RENDERER_AOV_LAYER_LAST, but trying to access any data using these results in a traceback:
aov_layer = vpost[c4d.REDSHIFT_RENDERER_AOV_LAYER_FIRST]
Traceback (most recent call last):
File "console", line 1, in <module>
AttributeError: Parameter value not accessible (object unknown in Python)
When an Alembic camera is merged into a scene, its Attributes panel has a Camera tab with all the usual camera properties. When I drag & drop the "Focal Length" property into the python console, I'm told that its value can be obtained with:
After a bit of digging around I was able to eliminate a couple of the magic numbers like so:
But how was the number 1028637 obtained? It isn't a plugin ID and there is no constant in the c4d namespace with this value. I don't like hard-coded numbers in my code, so I'd rather have a procedural way of obtaining this value.
On a related note, how does C4D know that this is a camera? It's type is reported as BaseObject not CameraObject. I'd like some way of determining, in code, whether or not an object is an Alembic camera.
My menugen code is able to rebuild the menu.
However, when it tries to use RegisterCommandPlugin() for the new python scripts it finds on disk, C4D issues an error indicating it can't find a .pyp file. Apparently this is because RegisterCommandPlugin() can't be used at any time except at application launch. And without the ability to RegisterCommandPlugin() for the new scripts, I can't add them to the newly built menu as menu items.
As @lasselauch points out, the issue is the functionality of the "Refresh" command.
I've added C4D support for our menu generation framework and it creates a hierarchical menu matching the python scripts it finds on disk just fine. Execution of those scripts works too.
The only issue is the inability of the Refresh menu item to rebuild the menu when it encounters a new script that didn't exist when C4D was launched.
I guess my only recourse is to pop up a MessageDialog telling the user that the Refresh command simply doesn't work in Cinema 4D.