I'm trying to get a python generator to only refresh when a source object is dirty, but can't seem to get it to work.
I move the object, change its geometry, change its parameters, it is never recognized as dirty.
I tried many different Dirty Flags and I can't get it to work.
Any idea what I'm doing wrong?
obj = op[c4d.ID_USERDATA,2]
print "object is dirty"
@r_gigante The reason I'm going with Gumroad is because it provides a system that I can automate as an indie developer. I can make useful C4D tools and plugins, but I'm not a web developer nor a fully-fledged programmer.
The current license system in Cinema 4D implies that the user generates License Information and sends it to the plugin developer to get get a personalized key back.
I could do this either by hand via emails, or by implementing an automated system on a website with an online software that does that.
The first option is a horrible ux experience for the user and a huge overhead for the developer, so it's an invalid option.
The second option requires me to become a full-blown web developer to make a simple c4d plugin, requiring completely disproportional amount of effort.
Therefore yes, I would argue having to develop our own license systems is a very big reason why c4d developers are so few.
Maxon implemented a new license system with 21, which would be great for plugins if they could use it. I.e. every plugin license to be added to the MyMaxon account, and let the maxon licensing system do the licensing. But this is not how we can use it.
Not only that but there are some very big limitations currently. If a studio account has 20 c4d licenses, I can't tie the plugin to a specific c4d version as I would with the serial numbers. I can only tie it to 1 machine, which is limiting and uncomfortable for the customer, or tie it to the account and allow them to only get 1 plugin license and use it in 20 different c4d licenses simultaneously.
In the end I see redshift have it's own license server, x-particles having their own licensing system, and the indie plugin developers having no idea what to do and how to do it.
Either way the licensing system has a lot of room for improvement. Currently it doesn't seem to be made with the plugin developers in mind; especially indie developers are struggling with it, as I've noticed in numerous people I talked with.
@lasselauch Thanks Lasse, that's great advice, GetObjects() should work.
Thanks @r_gigante for the feedback. I can't really comment from experience about the previous system, as I haven't developed a plugin for it.
I would be interested however to know how would you propose to solve the example I gave.
When I was inquiring about this case when the new licensing was introduced, I couldn't find any solution either.
We want to fulfill two requirements:
1. Provide a floating plugin license that can be installed in as many machines as the user wants.
2. If they have 20 c4d licenses and they bought 3 plugin licenses, they should be able to use it with 3 out of their 20 cinema 4d licenses.
It's pretty common case, I would guess many if not most plugins would have similar requirements.
I can solve the 1st case by tying the plugin to the User ID.
I can solve the 2nd case by tying the plugin to the machine ID but that breaks the 1st case.
I don't think any of the other information such as binary type, binary version or c4d licensing type is helping with the above. I would expect to use a Cinema 4D License ID but I don't believe it exists.
Thanks @m_magalhaes for looking it up, and writing a workaround, much appreciated!
I'm trying to get the material assignments for Redshift materials but I'm getting inconsistent results.
The code is:
material = doc.GetFirstMaterial()
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:
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.
I'm making a script that converts an FBX to alembic and loads it. It does it as follows:
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
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?
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.
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.
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?
"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.
@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
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?
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?