Multiple desclevel access



  • On 28/09/2017 at 11:03, xxxxxxxx wrote:

    Hello I currently try to get/set data from a customdatatype exposed in a UI.

    And I do not understand how to use GetParameter (Since my final things is in C++ but even in C++ I'm not able to get the result) while using direct acces to it using [] works perfectly

    import c4d
      
    def main() :
        rd = doc.GetActiveRenderData()
        vp = rd.GetFirstVideoPost()
        while vp:
            if vp.CheckType(1036219) :
                break
            vp = vp.GetNext()
      
        lv1 = c4d.DescLevel(3102)
        lv2 = c4d.DescLevel(6000)
      
        print vp[3102,6000] #print the correct value
        print vp.GetParameter(c4d.DescID(lv1, lv2), c4d.DESCFLAGS_GET_0) #print None
      
    if __name__=='__main__':
        main()
    

    I know is hard for you to test without the customdatatype (it's redshift, demo is aviable for free).
    Any hints is welcome, thansk in advance ! :)



  • On 29/09/2017 at 01:43, xxxxxxxx wrote:

    Hello,

    when construction a DescID it might be necessary to construct the full DescLevel including the type e.g.:

      
    sizeXID = c4d.DescID(c4d.DescLevel(c4d.PRIM_FRACTAL_LEN, c4d.DTYPE_VECTOR, 0), c4d.DescLevel(c4d.VECTOR_X, c4d.DTYPE_REAL, 0))  
    sizeX = landscape.GetParameter(sizeXID, c4d.DESCFLAGS_GET_0)  
    

    GetParameter() should return a custom data type like any other data type. For example this is how to edit an InExclude list:

      
    # add effector to the effectors list  
    ieData = moGraphCloner.GetParameter(c4d.ID_MG_MOTIONGENERATOR_EFFECTORLIST, c4d.DESCFLAGS_GET_0)  
      
    if ieData is not None:  
         ieData.InsertObject(reEffector, 1)  
         moGraphCloner.SetParameter(c4d.ID_MG_MOTIONGENERATOR_EFFECTORLIST, ieData, c4d.DESCFLAGS_SET_0)  
    

    What kind of data type we are talking about?

    best wishes,
    Sebastina



  • On 29/09/2017 at 02:39, xxxxxxxx wrote:

    Thanks for the answerd, but I don't know the type, I guess it's a CustomDataType<RSAOV> (Remember my final goal is to get/set in C++ I just go to python for testing). Since using the following code give me

    vp.GetParameter(3102, c4d.DESCFLAGS_GET_0)
    AttributeError: Parameter value not accessible (object unknown in Python)
    

    Moreover here you can see a screen of the actual layout. (In red the data I want to get id 6000, in blue the first container 3102)
    https://img11.hostingpics.net/pics/476834rscustomdatatype.jpg

    Note that I have already tried all DTYPE whithout success.
    Thanks in advance.



  • On 29/09/2017 at 08:56, xxxxxxxx wrote:

    Hello,

    using the Python or C++ API you can only access/edit the data types of Cinema 4D. Any other custom data type created by a third party is a "black box". Only the programmers of the Redshift renderer know what's inside this "RSAOV" data type and only they can provide an API for it.

    best wishes,
    Sebastian



  • On 29/09/2017 at 09:23, xxxxxxxx wrote:

    Then why vp[3102,6000] works since as I understand [] is just a wrapper around Get-SetParameter?



  • On 02/10/2017 at 00:58, xxxxxxxx wrote:

    Hello,

    the subscript operator automatically constructs the correct data type to access the parameter. As mentioned above, in some cases it might be needed to construct the full DescLevel including the correct data type.

    best wishes,
    Sebastian



  • On 02/10/2017 at 04:22, xxxxxxxx wrote:

    Ho, thanks my bad even if it's written in the documentation I was always thinked a DescLevel only accept DTYPE and not CUSTOMGUI_ID (which is used in my case and not a CUSTOMDATATYPE as I thought initially).

    Sadly it didn't fix the issue so I will contact rs dev, in any case thanks you a lot I understand way more how DescId and DescLevel works :)

    Another ask, which is more related to c4d, I notice vp[3102, 6000] only work when I do Show All Sub Containers. Then what really change in the description object wehn we activate this feature? Anyway thanks for everythings.

    EDIT: Ok got it working using c++ to know wich datatype is used. :D
    Here is my actual C++ code

    		RenderData* rd = doc->GetActiveRenderData();
    		BaseVideoPost* vp = rd->GetFirstVideoPost();
      
    		while (vp)
    		{
    			if (!vp) break;
    			if (vp->GetType() == 1036219) break;
      
    			vp = vp->GetNext();
    		}
      
    		BaseContainer* bc = vp->GetDataInstance();
    		Int32 i = 0;
    		while (true)
    		{
    			const Int32 id = bc->GetIndexId(i++);
    			if (id == NOTOK)
    				break;
    			else
    				if (id == 3102)
         					GePrint(String::IntToString(
    						bc->GetData(id).GetType()
    					 ));
      
    		}
    

    That give me the ID 1036235. And then using my previous script with this ID works like a charm.

        ID_CUSTOM_UI_AOV = 1036235
        lv1 = c4d.DescLevel(c4d.REDSHIFT_RENDERER_AOV_LAYER_FIRST, ID_CUSTOM_UI_AOV, 0)
        lv2 = c4d.DescLevel(c4d.REDSHIFT_AOV_ENABLED, c4d.DTYPE_BOOL, 0)
      
        print vp.GetParameter(c4d.DescID(lv1, lv2), c4d.DESCFLAGS_GET_0)
    

    The only things that reminds weird for me is. I don't know which datatype is used. I don't need it, but I would like to know the BasePlugin of this ID. By using the following code I thought I can actually find the BasePlugin of the type. But no success, why?

        ID_CUSTOM_UI_AOV = 1036235
        plug = c4d.plugins.GetFirstPlugin()
        while plug:
            if plug.GetID() == ID_CUSTOM_UI_AOV:
                print type(plug)
                break
                
            plug = plug.GetNext()
    

    This code print nothing and I don't understand why.
    Moreover using Set-GetParameter allow me to set/get data even if Show Sub Container feature is not activate which is what I want ! :D

    Anyway thanks in advance.



  • On 02/10/2017 at 08:47, xxxxxxxx wrote:

    Hello,

    the "dtype" member of a DescLevel has to be the ID of a data type. Either the ID of a build-in data type or of a custom data type. Custom GUIs have nothing to do with this.

    best wishes,
    Sebastian



  • On 02/10/2017 at 09:05, xxxxxxxx wrote:

    Sorry my bad I explain myself badly. Even if my problem is fully solved. My search add questions related of how things works. Then take you time for answering ;)

    - Why vp[first_id, second_if] = x only work when Show Sub Container features is enable? What does this Features exactly change to the actual host object?
    - Why I'm not able to find the pluginID of the CustomDataType retrieve with my previous C++ code into my list of plugin.
    Both method fails

    print plugins.FilterPluginList(c4d.PLUGINTYPE_CUSTOMDATATYPE, True) #return me an empty list
    

    And this one print nothing

    ID_CUSTOM_UI_AOV = 1036235
    plug = c4d.plugins.GetFirstPlugin()
    while plug:
        if plug.GetID() == ID_CUSTOM_UI_AOV:
            print type(plug)
            break
            
        plug = plug.GetNext()
    

    Again it's only for my knowledge, so is not a hight priority.
    But thanks in advance for the answers !


Log in to reply