On 13/02/2018 at 19:57, xxxxxxxx wrote:
I would like to know if with python we can read the name of the selections for a mesh object, without using the selection tags.
With Python, reading selection tags is very easy by exploring the object tree.
Until now, with the import of files with C4D, the selection tags were displayed in the list of objects.
But I recently discovered the new type of file with Alembic format , very convenient for handling complex scenes just before the final rendering.
C4D imports files in Alembic format, but it doesn't represent selections tags in the usual form, with triangular icons, in the list of objects.
We can however see these selections in the properties of the object, but under Python they aren't accessible through tags.
In this example, with Marvelous Designer, we see that the mesh selection tags aren't displayed.
I also have this problem with alembic file exported by Daz Studio 4.10
I can indirectly establish for each object the list of these selections, by previously importing the file in FBX format because C4D uses in this case the usual selection tags.
But this way of proceeding leads me to go through an intermediate stage.
Even with files imported in Alembic format, it is possible with Python to apply a material to a mesh with a selection, using the following line of code:
**textag[c4d.TEXTURETAG_RESTRICTION] = selection_name**
This means that C4D does have the correct information about the mesh selections, even if they aren't displayed with the usual tags.
Below a tutorial who show how an user import in C4D an alembic file, for texturing it.
This user use an FBX export to obtains the list of materials.
Then, the application of textures is done manually.
It's clever, but appallingly long and tedious !
It's this procedure that I fully automated with Python, under C4D.
With the FBX file, I build the object tree including the selections.
But I would like to do this without going through an FBX file.
The developers of C4D have certainly, for technical reasons, treated the files in Alembic format in a different way, but it would still be interesting to be able to handle them with Python.