-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why sometimes different from PyMaterialX #157
Comments
Hi Arthur, Are you sure that you're working with a complete build of MaterialX Python? There are calls to NodeGraph.addNode in our Python test suite, for example, which runs as part of the continuous integration process for the MaterialX library: https://github.com/materialx/MaterialX/blob/master/python/MaterialXTest/main.py#L189 If you build MaterialX Python through CMake, and install the resulting Python package to your Python environment, you should see a collection of Python wrappers such as main.py and datatype.py in the distribution, and not just the raw PyMaterialX shared library. Full build instructions can be found here, and let us know if we can clarify any of the steps: http://www.materialx.org/docs/api/index.html All the best, -Jonathan |
this is my cmake command |
Hi Arthur, Could it be that you're building MaterialX with the command above, but never installing the MaterialX Python package to a destination folder? In our online test suite, for example, we build and install MaterialX with the following command:
In the Appveyor/Windows test suite, this installs MaterialX Python to the "site-packages" folder of the Python installation, and in the Travis/Linux test suite, it installs MaterialX Python to a local folder for testing. -Jonathan |
Hi Arthur, I'm going to close out this issue for now, and feel free to follow up on the MaterialX Discussion Forum if you have additional build questions: https://groups.google.com/forum/#!forum/materialx All the best, -Jonathan |
use codeexamples :
import MaterialX as mx
Create a document.
doc = mx.createDocument()
Create a node graph with a single image node and output.
nodeGraph = doc.addNodeGraph()
image = nodeGraph.addNode('image')
image.setParameterValue('file', 'image1.tif', 'filename')
output = nodeGraph.addOutput()
output.setConnectedNode(image)
Create a simple shader interface.
shader = doc.addNodeDef('shader1', 'surfaceshader', 'simpleSrf')
diffColor = shader.setInputValue('diffColor', mx.Color3(1.0))
specColor = shader.setInputValue('specColor', mx.Color3(0.0))
roughness = shader.setParameterValue('roughness', 0.25)
Create a material that instantiates the shader.
material = doc.addMaterial()
shaderRef = material.addShaderRef('shaderRef1', 'simpleSrf')
Bind roughness to a new value within this material.
bindParam = shaderRef.addBindParam('roughness')
bindParam.setValue(0.5)
Display the value of roughness in the context of this material.
print str(roughness.getBoundValue(material))
the code "image = nodeGraph.addNode('image')" can't run
mistake will be display "'PyMaterialX.NodeGraph' object has no attribute 'addNode'"? why? thankes for you reply!
The text was updated successfully, but these errors were encountered: