how to get the name of all texturefiles?
On 16/04/2017 at 19:11, xxxxxxxx wrote:
Cinema 4D Version: R16
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
I'm tring to get names of all texture files by C.O.F.F.E.E script.But I can't find a simple methord to get that.
Now I'm using doc->GetFirstMaterial() and tempmaterial#MATERIAL_COLOR_SHADER to get a texture name and then getnext().
But obviously it's too complicated and it's hard to deal complex shader.
So I wonder if there exist an easier methord to get all texture files just like GetAllTextures() in python script.
On 17/04/2017 at 08:44, xxxxxxxx wrote:
Hi and welcome to the Plugin Cafe!
I'm afraid C.O.F.F.E.E is quite limited and there is no easy way to retrieve all the textures for a document.
Why not consider using Python? What kind of script/plugin are you developing?
On 17/04/2017 at 18:32, xxxxxxxx wrote:
Thanks for your reply.
I'm trying to use this script by windows command line,just like:Cinema 4D.exe loadfile XX.C4D loadfile XX.csc.
But python script seems not support that.
Or support it by another methord?
On 18/04/2017 at 03:46, xxxxxxxx wrote:
A python script can't be automatically executed from the command line. Instead the Python API allows to process the command line arguments.
This has to be done from PluginMessage() and the corresponding C4DPL_COMMANDLINEARGS message.
Here's a simple code snippet to be saved into a pyp file located inside the plugins folder:
import c4d import sys def PluginMessage(id, data) : if id==c4d.C4DPL_COMMANDLINEARGS: if '-ProcessTextures' in sys.argv: print "Process Textures Started" return True return False
Note, the command line arguments set into sys.argv can't be consumed in Python. This is a know limitation.
So you should see the following minor warning output into the console:
Warning: Unknown arguments: -ProcessTextures
For more information on PluginMessage() see Python SDK docs Command Line Arguments.
On 18/04/2017 at 20:33, xxxxxxxx wrote:
Thank you for your help.Python is powerful but I do need to use the coffee script.
And now I want to know how to get layer parameters from different layers.
Just like the type of reflectance layers in c4d material.
On 19/04/2017 at 02:26, xxxxxxxx wrote:
I'm afraid C.O.F.F.E.E. API is quite limited and reflectance layers from a Material can't be accessed.
C++ and Python APIs can return such information.
What do you really want to do?
Your previous post about calling Cinema 4D by command line with unknow loadfile argument is confusing:
Originally posted by xxxxxxxx
Cinema 4D.exe loadfile XX.C4D loadfile XX.csc.
Do you have an already existing C.O.F.F.E.E. script that you want to extend for your needs?
Why not converting it to Python? We can help you in doing such conversion. Then this converted script could be extended easily.
On 19/04/2017 at 03:54, xxxxxxxx wrote:
Yes, I already have a C.O.F.F.E.E.script and want to extend.
But now I have to convert to python.
Thanks so much.And I'll try python.