How to change DzMaterial image map in the property

GenerationXGenerationX Posts: 56

It seems there is no such function for the "setMap" like the scripting!

    DzNode *node = dzScene->findNodeByLabel(nodeName);  if (!node)return;
    DzObject *obj = node->getObject();                    if (!obj)return;
    int numShapes = obj->getNumShapes();
    for (int s = 0; s < numShapes; s++) {
        DzShape       *shape = obj->getShape(s);            if (!shape)break;
        DzMaterial *mat = shape->findMaterial(matName); if (!mat)break;
        DzProperty *prop = mat->findProperty(propName); if (!prop)break;
        
        prop->setMap(texturePath); //<---= How to change DzMaterial image map!!!!

}

Post edited by GenerationX on

Comments

  • rbtwhizrbtwhiz Posts: 2,261

    Although the syntax is slightly different, the API is the same.

     In script, where you would use...

    	if ( oProp &amp;&amp; oProp.inherits( "DzNumericProperty" ) &amp;&amp; oProp.isMappable() ){		oProp.setMap( texturePath );	}

    ... in C++, you would use...

    	DzNumericProperty* nprop = qobject_cast&lt;DzNumericProperty*&gt;( prop );	if ( nprop &amp;&amp; nprop-&gt;isMappable() )	{		nprop-&gt;setMap( texturePath );	}

     

    -Rob

  • Forgot about the DzNumericProperty... Its working now :)....

    Thanks

    Dare

  • GenerationXGenerationX Posts: 56
    edited November 2017

    Some how when rendering in a Image-Series, the suface shaders do not update and a white texture is rendered, the veiw-port is updated ok! Any way of turning the surfaces image update back on?

    Post edited by GenerationX on
Sign In or Register to comment.