SCRIPT: Octane SmoothMeshPreview

Forums: SCRIPT: Octane SmoothMeshPreview
Sub forum for help and tutorials.

Moderator: JimStar

SCRIPT: Octane SmoothMeshPreview

Postby calus » Wed Jan 25, 2017 1:14 pm

calus Wed Jan 25, 2017 1:14 pm
Here is a simple python script to render Maya smooth mesh preview with Octane:

The script connects the Maya Smooth Mesh Preview to Octane Opensubdiv level for all meshes found in the selected objects/hierarchy.

Once the script is applied to a mesh, Octane will always respect these settings :
maya_2017-01-25_13-52-02.png

(meaning that if needed you can still have one subdiv level for the viewport and another for rendering )

when using the hotkeys 0, 1, 2, 3, page-up, page-down, remember that IPR only refresh the smoothing if the mesh is of the "reshapable" type.
and keep in mind that the Maya plugin also doesn't support the subdiv Crease.

As usual open or copy this script in a python tab in the script editor and execute, or drop it in a shelf as python button.
OctaneSmoothMeshPreview_0.1.py.zip
(602 Bytes) Downloaded 307 times


Code: Select all
# This script create an expression for all meshes found in the selected objects/hierarchy.
# The expression connects Maya Smooth Mesh Preview attributes to Octane Opensubdiv level.
# "smooth mesh preview" and "use Preview level for rendering" are respected .
# v 0.1

import maya.cmds as cmd

meshes = cmd.listRelatives(cmd.ls(sl= True, visible=True) , path=True, type="mesh", allDescendents=True, ni=True)
   
if meshes:
   for mesh in meshes:
      connected = cmd.listConnections(mesh+".octSubdLevel", s=True, d=False)
      if not connected:
         cmd.expression(o=mesh, s="octSubdLevel = (displaySmoothMesh>0) * ((useSmoothPreviewForRender==0) ? renderSmoothLevel : smoothLevel );")
         print (mesh+".octSubdLevel is connected")
Pascal ANDRE
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: SCRIPT: Octane SmoothMeshPreview

Postby Tharso » Wed Feb 01, 2017 12:25 am

Tharso Wed Feb 01, 2017 12:25 am
one more thank you,,
User avatar
Tharso
Licensed Customer
Licensed Customer
 
Posts: 281
Joined: Mon Apr 05, 2010 3:11 pm
Location: Brasil

Return to Help / Tutorials


Who is online

Users browsing this forum: No registered users and 3 guests

Sun Apr 28, 2024 10:26 am [ UTC ]