Announcement

Collapse
No announcement yet.

Getting node parameters

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting node parameters

    When rendering, the compute node gets called with a VRayGeomInfo object and a corresponding "Node" node gets created in the vrscene, with geometry, material, transform...
    In the same compute node, I am then creating a new "Node" node from the pluginManager, and would like to assign the same material and transform that was sent to the current VRayGeomInfo node.

    How can I retrieve the material and transform parameters from the VRayGeomInfo-Node plugin ?
    Thanks.

  • #2
    All parameters that V-Ray for Maya creates can be cloned. See the "VRayCloneableParamInterface" in defparams.h from the SDK.

    Code:
                    VRayCloneableParamInterface * cloneable = static_cast<VRayCloneableParamInterface*>(param->newInterface(EXT_CLONEABLE_PARAM));
    
    		if(cloneable) {
    			// if the parameter is cloneable - just clone it
    			VRayPluginParameter * newParam = cloneable->clone();
    
    			if(newParam) {
    				plugin->setParameter(factory->saveInFactory(newParam));
    			}
    		}
    V-Ray/PhoenixFD for Maya developer

    Comment


    • #3
      Thanks Ivaylo. However my question was more about how to find the 'param' you have in your first line of code ?
      As I am unable to identify the 'Node' plugin which is created by default, I can't extract the "material" parameter from it. Thanks.

      Comment


      • #4
        You can't get the node in compute() since it's not created yet, and there are potentially many nodes using the same geometry. The correct way is shown in vray_geommeshloader for example, where newInstance() gets the assigned material/transform and then can pass them to another plugins.

        Code:
        VRayStaticGeometry* GeomMeshLoader::newInstance(MaterialInterface *_mtl, BSDFInterface *bsdf, int renderID, VolumetricInterface *volume, LightList *lightList, const TraceTransform &baseTM, int objectID, const tchar *userAttr, int primaryVisibility) {
        	// Try to obtain a geometry source interface
        	if (geomPlugin) {
        		// Get the geometry interface from it
        		StaticGeomSourceInterface *geomSource=static_cast<StaticGeomSourceInterface*>(GET_INTERFACE(geomPlugin, EXT_STATIC_GEOM_SOURCE));
        		if (geomSource) return geomSource->newInstance(_mtl, bsdf, renderID, volume, lightList, baseTM, objectID, userAttr, primaryVisibility);
        	}
        	return NULL;
        }
        Finding the actual plugin to duplicate the parameters is more difficult, since you must get the plugin manager (there is an example in the same file) and search for nodes that have this geometry assigned.
        V-Ray/PhoenixFD for Maya developer

        Comment

        Working...
        X