Jump to content

How to get a non const argument as first input with inlinecpp. Is it b


Recommended Posts

Hi guys.

When I get two input with inlinecpp, if I don't use const on argument, it will be error.

What's matter? It looks a bugs.

Help me.

========================== Error..=========================

# This code is called when instances of this SOP cook.

node = hou.pwd()

geo = node.geometry()

node2 = node.inputs()[1]

geo2= node2.geometry()

# Add code to modify the contents of geo.

import inlinecpp

inlinecpp.extendClass(hou.Geometry, "pTredasde",

includes="""

""",

function_sources=["""

int pTree(GU_Detail * gdp, const GU_Detail * gdp2)

{

cout<<gdp->points().entries()<<endl;

cout<<gdp2->points().entries()<<endl;

return 0;

}

"""])

print geo.pTree(geo2)

=========================== OK ====================================================

# This code is called when instances of this SOP cook.

node = hou.pwd()

geo = node.geometry()

node2 = node.inputs()[1]

geo2= node2.geometry()

# Add code to modify the contents of geo.

import inlinecpp

inlinecpp.extendClass(hou.Geometry, "pTredasde",

includes="""

""",

function_sources=["""

int pTree(const GU_Detail * gdp, const GU_Detail * gdp2)

{

cout<<gdp->points().entries()<<endl;

cout<<gdp2->points().entries()<<endl;

return 0;

}

"""])

print geo.pTree(geo2)

===========================================

What is problem on second one? It is just different with first one on argument.

There is no const.

Edited by mayalife
Link to comment
Share on other sites

Thanks Graham, for your attention.

In my case, it is not error only when I get a const arguments both of two input on inlinecpp module.

I don't know why it does like that. When I get just one input argument, it's no problem.

So I'm curious about that. It's my wrong gramma or just problem on my computer.

So I can't modify first input.

Edited by mayalife
Link to comment
Share on other sites

Guest mantragora

What is problem on second one? It is just different with first one on argument.

There is no const.

From inlineCpp help:

In other words, only use a GU_Detail * for functions being called from a Python SOP where you can modify the geometry. For functions that do not modify the geometry, use a const GU_Detail * parameter.

EDIT: On the other hand I don't know :). When you "createLibrary" it also doesn't allow to have main geo not marked as "const" while geo from second input is also passed. Man, I really hate inlineCpp. Switch to HDK. It's easier to debug.

Edited by mantragora
Link to comment
Share on other sites

Unfortunately your hip file is missing the otl, but I was able to see from it that you are attempting to use Windows. Running your broken block from my Windows partition I do get the compiling error, meaning it's a Windows specific issue. Things work as expected on Linux, hence my earlier replies. I've submitted a bug to SESI.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...