How to change DzMaterial image map in the property

GenerationXGenerationX Posts: 50

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: 1,431

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

     In script, where you would use...

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

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

    	DzNumericProperty* nprop = qobject_cast<DzNumericProperty*>( prop );
    	if ( nprop && nprop->isMappable() )
    	{
    		nprop->setMap( texturePath );
    	}

     

    -Rob

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

    Thanks

    Dare

  • GenerationXGenerationX Posts: 50
    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.