Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

how to get the name of all texturefiles?

 Post Reply Post Reply
Author
Message
yumefx View Drop Down
Member
Member


Joined: 2017 Apr 16
Online Status: Offline
Posts: 4
Post Options Post Options   Quote yumefx Quote  Post ReplyReply Direct Link To This Post Topic: how to get the name of all texturefiles?
    Posted: 2017 Apr 16 at 7:11pm

User Information:

Cinema 4D Version:   R16 
Platform:   Windows  ;   
Language(s):   C.O.F.F.E.E  ;    

---------

hello guys:

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. 
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1052
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 17 at 8:44am
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?



MAXON
Developer Support
Back to Top
yumefx View Drop Down
Member
Member


Joined: 2017 Apr 16
Online Status: Offline
Posts: 4
Post Options Post Options   Quote yumefx Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 17 at 6:32pm
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?
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1052
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 18 at 3:46am
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.



MAXON
Developer Support
Back to Top
yumefx View Drop Down
Member
Member


Joined: 2017 Apr 16
Online Status: Offline
Posts: 4
Post Options Post Options   Quote yumefx Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 18 at 8:33pm
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.


Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1052
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 19 at 2:26am
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 yumefx

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.





Edited by Yannick Puech - 2017 Apr 19 at 2:33am
MAXON
Developer Support
Back to Top
yumefx View Drop Down
Member
Member


Joined: 2017 Apr 16
Online Status: Offline
Posts: 4
Post Options Post Options   Quote yumefx Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 19 at 3:54am
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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.