i try to make a clone shader command...
here is small portion of the python script.
if you select a node in the render tree and run, it should work so far.
PortType remains unknown...


### Import Definitions

from win32com.client import constants as si

### Simplify Commands

a = Application

### Get The Active View

oLayout = a.Desktop.ActiveLayout
oRTViews = oLayout.Views.Filter( "Render Tree" )

x = oRTViews(0)
y = x.GetAttributeValue( "selection" ).split(",")

### Get The Shader Parameters

a.SelectObj(y, "", "")

oNode = a.Selection(0)


### Do Stuff

print oNode

for i in oNode.Parameters :
    print i







On 3/3/2015 10:54 AM, Dan Yargici wrote:
Ah, looks like you're trying to get the port type of a parameter object rather than a port.

I'd check the SDK docs. I'd need to know more about the context of what you're trying to do to be of any help.

DAN

On Tue, Mar 3, 2015 at 9:50 AM, Dan Yargici <danyarg...@gmail.com <mailto:danyarg...@gmail.com>> wrote:

    Hi Jan,

    Try:

    for i in oNode.Parameters :
        if ( i.PortType == 0 ) :
            print i


        siPortType


          Description

    Enumerates the different kinds of ports.


          C# Syntax

    siPortType.siPortInput                                                      
 // 0
    siPortType.siPortOutput                                                     
// 1

    Constant    Value   Description
    siPortInput         0       Input port.
    siPortOutput        1       Output port.





    On Tue, Mar 3, 2015 at 9:45 AM, Jan Dubied
    <j.dub...@onlinevideo.ch <mailto:j.dub...@onlinevideo.ch>> wrote:

        thank you jacob
        i should have been more exact:

        i can get the selected shader node, but i did not post that
        part here.
        the only thing i cannot evaluate is if "i" (the shader
        parameter) is input or output...

        for exaple:

        for i in oNode.Parameters :
                print i

        this prints the parameters of the shader. in- and output.

        # Sources.Materials.DefaultLib.Scene_Material.Phong.Name
        <http://Sources.Materials.DefaultLib.Scene_Material.Phong.Name>
        # Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse
        # Sources.Materials.DefaultLib.Scene_Material.Phong.specular
        # Sources.Materials.DefaultLib.Scene_Material.Phong.out







        On 3/3/2015 10:40 AM, Jacob Gonzalez wrote:
        Not sure if this is what you are trying to do, hope it helps:

        for param in oNode.NestedObjects:
            if  param.Name == "surface":
                surfaceParam = param

        myOutputShader = surfaceParam.NestedObjects(0)

        print   myOutputShader
        >>>> sphere.Material.Lambert

        On Tue, Mar 3, 2015 at 7:53 AM, Jan Dubied
        <j.dub...@onlinevideo.ch <mailto:j.dub...@onlinevideo.ch>> wrote:

            hi guys
            any idea how i can sort out "output" ports and just query
            shader input parameters?

            i tried this:

            for i in oNode.Parameters :
                if ( i.PortType == siPortInput ) :
                    print i

            where oNode is the selected shader node in the render tree.
            but it seems that PortInput is not defined...

            thanks in advance


--
            
------------------------------------------------------------------------

            Jan Dubied
            2D/3D Artist

            *ON LINE VIDEO 46 AG*
            Leutschenbachstr. 46 / 8050 Zurich / Switzerland
            Phone +41 44 305 73 73 <tel:%2B41%2044%20305%2073%2073> /
            Fax +41 44 305 73 00 <tel:%2B41%2044%20305%2073%2000>
            www.onlinevideo.ch <http://www.onlinevideo.ch/>



--
        ------------------------------------------------------------------------

        Jan Dubied
        2D/3D Artist

        *ON LINE VIDEO 46 AG*
        Leutschenbachstr. 46 / 8050 Zurich / Switzerland
        Phone +41 44 305 73 73 <tel:%2B41%2044%20305%2073%2073> / Fax
        +41 44 305 73 00 <tel:%2B41%2044%20305%2073%2000>
        www.onlinevideo.ch <http://www.onlinevideo.ch/>




--

------------------------------------------------------------------------

Jan Dubied
2D/3D Artist

*ON LINE VIDEO 46 AG*
Leutschenbachstr. 46 / 8050 Zurich / Switzerland
Phone +41 44 305 73 73 / Fax +41 44 305 73 00
www.onlinevideo.ch <http://www.onlinevideo.ch/>

Reply via email to