Execute Cinema4D commands through script
On 07/08/2017 at 13:27, xxxxxxxx wrote:
I created an importer which imports a whole bunch of objects (~20'000) into a scene. I already avoided creating any duplicate objects (by automatically replacing them with instances), but since some geometrically different objects still share a common material, I end up with a few (~30%) duplicate materials (can't avoid that since it's an OBJ import with MTLs).
After the import, I want my script to automatically do the two steps I currently do "by hand", namely execute the two commands "Remove Duplicate Materials" and "Remove Unused Materials".
Is there an easy way to do that or do I have to "recreate" those two functions in my script?
On 07/08/2017 at 13:55, xxxxxxxx wrote:
Nevermind, figured it out through a convoluted search:
c4d.CallCommand(12211) # Remove Duplicate Materials
c4d.CallCommand(12168) # Remove Unused Materials
On 07/08/2017 at 16:33, xxxxxxxx wrote:
You don't really need a convoluted search. Simply open the Customize Commands dialog and select the command you need the ID for. Then this ID will be shown in the lower right corner with the other buttons.
On 08/08/2017 at 01:48, xxxxxxxx wrote:
Another option would be to open the "Script Log" from "Script" menu. Then simply execute the needed commands and get the code lines from the log.
On 08/08/2017 at 02:07, xxxxxxxx wrote:
The convoluted search was finding those two answers :).