Page 3 of 7

Re: creating shortcut via python for "Auto Arrange Selected"

PostPosted: Fri Jul 08, 2022 11:19 pm
by aoktar
Delizade wrote:Hello,
is it possible to create shortcut via python for "Auto Arrange Selected". If we can use octane functions via python it must be possible. Could you anyone knows anything about this?
for example I know we can add octane nodes via python so I thought that maybe we can use some menu commands as well.

thank you

This is an internal function and they needs to be exposed to python interface. Creating the nodes are done by as creating C4D materials or textures because they are just defined plugins by some ID. Both are not same.

Re: ==== Octane useful scripts ====

PostPosted: Fri Jul 08, 2022 11:26 pm
by aoktar
DunHou wrote:yes ,Delizade is right. I also wang to a "Auto Arrange Selected" button.and a lot of setting in python i cannot find in octane,Now in 2021version,aov system seems not work with old pipline,and i cant fix it with py scripts.will octane post a sdk or provide a scirpts exsample .
Thanks

It's now different than older one to provide the new flexible way for AOVs. See following c++ example, it's showing how I'm adding one AOV under to Octane VideoPost data. Here "parent" is Octane VideoPostData.

Code: Select all
BaseList2D *addAOVnode(BaseList2D *parent, Int32 slotID, Int32 TYPE, Octane::RenderPassId passId, Bool incCnt)
{
    BaseContainer *bc = parent->GetDataInstance();
    Int32 pType = bc->GetInt32(AOV_NODE_TYPE);

    BaseList2D *shd = addOctaneShaderToNode(parent, slotID, ID_OCTANE_AOV_NODE);

    if(TYPE==AOV_TYPE_COMP_GROUP)       {  shd->SetName(AOV_GROUP_NAME);  }
    else if(TYPE==AOV_TYPE_COMP_AOV)         {  shd->SetName(AOV_COMP_NAME);  }
    else if(TYPE==AOV_TYPE_COMP_AOV_LAYER)   {  shd->SetName(AOV_COMPLAYER_NAME);  }
    else if(TYPE==AOV_TYPE_COLOR_OUT)        {  shd->SetName(AOV_COLOROUT_NAME);  }
    else if(TYPE==AOV_TYPE_IMAGE_AOV_OUT)    {  shd->SetName(AOV_IMAGEOUT_NAME);  }
    else if(TYPE==AOV_TYPE_COMP_LIGHTMIXER)  {  shd->SetName(AOV_IMAGEOUT_NAME);  }
    else if(TYPE==AOV_TYPE_RENDER_AOV_OUT)
    {
        shd->SetParameter(DescLevel(AOV_RENDER_PASS_ID), GeData((Int32)passId), DESCFLAGS_SET_0);
        shd->SetName(AOV_RENDEROUT_NAME+S(":[")+Octane::ApiInfo::renderPassName(passId)+"]");
    }

    setParameterLong(*shd, AOV_NODE_TYPE, TYPE);
    if(incCnt)
    {
        Int32 cnt = bc->GetInt32(AOV_INPUT_COUNT);
        setParameterLong(*parent, AOV_INPUT_COUNT, cnt+1);
    }
    return shd;
}

Re: Getting Current Rendering Information Via Python

PostPosted: Fri Jul 08, 2022 11:28 pm
by aoktar
freakanay wrote:Hi people!

I've been struggling with this for a while, and I still cannot find the correct way to do it: I would like to get current rendering information of my scene that's using Octane - things like what frame the render is currently on, how long it took to render per frame, etc.
I see in the console all the Octane info and basically, I just want the same info but through the Python terminal.

Does anyone know the right syntaxes for this?!

Thanks a bunch!

There's not any communication to read internal function for partial render times for several render processes. You may read estimated render time as how you do with Standard Renderer.

Brings the material of the selected object to the node editor.

PostPosted: Tue Aug 23, 2022 2:58 am
by Delizade
Hello,

If you work with many materials and if you edit materials frequently
this script brings material into Octane Node Editor directly without additional clicks.
Assigning a shortcut makes easier workflow.

Select_Active_Object_Material_In_NodeEditor.zip
(537 Bytes) Downloaded 356 times

Re: ==== Octane useful scripts ====

PostPosted: Tue Sep 06, 2022 9:38 pm
by aoktar
This script is for resetting the Compression of ImageTexture to "Automatic". You can freely change it for different compression values or selected materials.

Code: Select all
from typing import Optional
import c4d
from c4d import gui

doc: c4d.documents.BaseDocument  # The active document
op: Optional[c4d.BaseObject]  # The active object, None if unselected

ID_OCTANE_IMAGE_TEXTURE = 1029508

def collect(shdList, n):
   
    if n==None: return
   
    if n.GetType()==ID_OCTANE_IMAGE_TEXTURE:
        ix=-1
        try:
            ix = shdList.index(n)
        except:
            ix=-1

        if ix==-1:  shdList.append(n)

    if n.GetDown(): collect(shdList, n.GetDown())
    if n.GetNext(): collect(shdList, n.GetNext())


def main() -> None:
    # Called when the plugin is selected by the user. Similar to CommandData.Execute.
    matList = doc.GetMaterials()
   
    for mat in matList:
       
        shaders = []
        collect(shaders, mat.GetFirstShader())
   
        for n in shaders:
            n[c4d.IMAGETEX_COMPR_FORMAT]=0  #reset the compression
       
        c4d.EventAdd()   

if __name__ == '__main__':
    main()

Re: ==== Octane useful scripts ====

PostPosted: Fri Sep 23, 2022 9:29 am
by aoktar
Here's another script. It's for finding OctaneRender videopost and reading the AOVs from "render AOV group".

Re: ==== Octane useful scripts ====

PostPosted: Thu Oct 20, 2022 2:34 pm
by silanbekjarov
Hi @aoktar I`ve posted in a few other posts about my problem Im trying to solve rn mid-production... I have octane materials, their real paths are correct and in the suggested file path is only the file name of the file. This way the native project asset inspector is showing the texture as missing. But if I change the filepath to absolut in the image texture node or just put the "real path" in the "suggested path" in the octane texture manager it automatically has the texture found in the native c4d project asset inspector.

could you maybe help me with a script that changes the relative path (filename) to the absolute path (full path). I`d really appreciate any help from anyone reading this, as Im kinda trying to solve this to be able to render..

Thanks a lot.
<3

Re: ==== Octane useful scripts ====

PostPosted: Thu Oct 20, 2022 2:43 pm
by aoktar
silanbekjarov wrote:Hi @aoktar I`ve posted in a few other posts about my problem Im trying to solve rn mid-production... I have octane materials, their real paths are correct and in the suggested file path is only the file name of the file. This way the native project asset inspector is showing the texture as missing. But if I change the filepath to absolut in the image texture node or just put the "real path" in the "suggested path" in the octane texture manager it automatically has the texture found in the native c4d project asset inspector.

could you maybe help me with a script that changes the relative path (filename) to the absolute path (full path). I`d really appreciate any help from anyone reading this, as Im kinda trying to solve this to be able to render..

Thanks a lot.
<3

Help me understand why do you need it! It should not be any problems what you see in texture managers. Render manager will know where to find the textures. Looks to directories under the project for first, later will check the texture search paths. It doesn't any matter if texture dialogs do show they are missing.

Re: ==== Octane useful scripts ====

PostPosted: Tue Jan 03, 2023 3:56 pm
by ShivaMist
Rookie wrote:Hi :
I am working on my tool set,but i cannot switch render engine to octane correct. (C4D R24+octane 2020.2.3.R6)
the render engine in the drop down (render settings) is named Octane render,

but there is no "post effect" octane in the post effect list

If you have a new Document and you switch to octane render by hand and then back to standard by hand. and after that execute the script. the "post effect" octane will be there and the render will be the one to render.

Is there a right/better way to switch to octane. so that it works even if the user did not switch back before by hand?

wish your help plz



Code: Select all
import c4d

def main() :
rdata = doc.GetActiveRenderData()
vpost = rdata.GetFirstVideoPost()
OctaneRender_ID = 1029525
rdata[c4d.RDATA_RENDERENGINE] = OctaneRender_ID

on = False

while vpost:
if vpost.CheckType(c4d.VPxmbsampler) :
on = True
vpost = vpost.GetNext()

if on == False:
vpost = c4d.BaseList2D(c4d.VPxmbsampler)
rdata.InsertVideoPost(vpost)

c4d.EventAdd()

main()


I'm experiencing the same issue trying to make a script to setup different render engines and render settings, the only workaround is to use a file with render settings already set on Octane Render by hand. Anybody got around this issue ?

Re: ==== Octane useful scripts ====

PostPosted: Tue Jan 17, 2023 5:13 pm
by ShivaMist
Is this topic dead ?