adam_perin Posted June 22, 2020 Share Posted June 22, 2020 (edited) Looking at the sample GUI_PolygonNormalShade, I'm trying to replace the material in the viewport when a visualizer is set. I have been trying to do this by copying the approach used in GUI_PolygonNormalShade but instead of writing new "Cd" attributes I want to write a new "shop_materialpath" attribute to the detail attributes. Its look like everything is correct (no crashes or errors) but I'm still not getting the new material to show in the viewport. Any ideas would be super helpful. Here is the code from the filterPrimitive function. processed = GR_PROCESSED; char arr[] = "/mat/test"; OP_Node* matNode = OPgetDirector()->findNode(arr); if (!matNode) { OP_Network *parent = (OP_Network *)OPgetDirector()->findNode("/mat"); parent->createNode("tooncolorshader", "test"); matNode = OPgetDirector()->findNode(arr); } string path(arr); auto indexedString = new GT_DAIndexedString(1); indexedString->setString(0, 0, path.c_str()); GT_AttributeListHandle dah = gt_prm->getDetailAttributes()->addAttribute("shop_materialpath", indexedString, true); auto mesh = UTverify_cast<const GT_PrimPolygonMesh *>(gt_prm.get()); ph = new GT_PrimPolygonMesh(*mesh, mesh->getPointAttributes(), mesh->getVertexAttributes(), mesh->getUniformAttributes(), dah); // return a new polygon mesh with modified shop_materialpath attribute. return ph; Edited June 22, 2020 by adam_perin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.