예제 #1
0
 def _importVray(self, filePath, importSettings, *args, **kwargs):
     # cmds.confirmDialog(title='Ongoing development', message="Vray Proxy Import for Maya is under development")
     directory, name = os.path.split(filePath)
     cmds.vrayCreateProxy(node="%s" % name,
                          existing=True,
                          dir=filePath,
                          createProxyNode=True)
예제 #2
0
    def process(self, instance):

        staging_dir = self.staging_dir(instance)
        file_name = "{}.vrmesh".format(instance.name)
        file_path = os.path.join(staging_dir, file_name)

        anim_on = instance.data["animation"]
        if not anim_on:
            # Remove animation information because it is not required for
            # non-animated subsets
            instance.data.pop("frameStart", None)
            instance.data.pop("frameEnd", None)

            start_frame = 1
            end_frame = 1
        else:
            start_frame = instance.data["frameStart"]
            end_frame = instance.data["frameEnd"]

        vertex_colors = instance.data.get("vertexColors", False)

        # Write out vrmesh file
        self.log.info("Writing: '%s'" % file_path)
        with avalon.maya.maintained_selection():
            cmds.select(instance.data["setMembers"], noExpand=True)
            cmds.vrayCreateProxy(exportType=1,
                                 dir=staging_dir,
                                 fname=file_name,
                                 animOn=anim_on,
                                 animType=3,
                                 startFrame=start_frame,
                                 endFrame=end_frame,
                                 vertexColorsOn=vertex_colors,
                                 ignoreHiddenObjects=True,
                                 createProxyNode=False)

        if "representations" not in instance.data:
            instance.data["representations"] = []

        representation = {
            'name': 'vrmesh',
            'ext': 'vrmesh',
            'files': file_name,
            "stagingDir": staging_dir,
        }
        instance.data["representations"].append(representation)

        self.log.info("Extracted instance '%s' to: %s"
                      % (instance.name, staging_dir))
예제 #3
0
    def process(self, instance):

        staging_dir = self.staging_dir(instance)
        file_name = "{}.vrmesh".format(instance.name)
        file_path = os.path.join(staging_dir, file_name)

        anim_on = instance.data["animation"]
        if not anim_on:
            # Remove animation information because it is not required for
            # non-animated subsets
            instance.data.pop("startFrame", None)
            instance.data.pop("endFrame", None)

            start_frame = 1
            end_frame = 1
        else:
            start_frame = instance.data["startFrame"]
            end_frame = instance.data["endFrame"]

        # Write out vrmesh file
        self.log.info("Writing: '%s'" % file_path)
        with avalon.maya.maintained_selection():
            cmds.select(instance.data["setMembers"], noExpand=True)
            cmds.vrayCreateProxy(exportType=1,
                                 dir=staging_dir,
                                 fname=file_name,
                                 animOn=anim_on,
                                 animType=3,
                                 startFrame=start_frame,
                                 endFrame=end_frame,
                                 ignoreHiddenObjects=True,
                                 createProxyNode=False)

        if "files" not in instance.data:
            instance.data["files"] = list()

        instance.data["files"].append(file_name)

        self.log.info("Extracted instance '%s' to: %s" %
                      (instance.name, staging_dir))
예제 #4
0
    def _exportVray(self,
                    filePath,
                    exportSettings,
                    exportSelected=True,
                    timeRange=[0, 10]):
        # TODO: // export vray core function for Maya
        # cmds.confirmDialog(title='Ongoing development', message="Vray Proxy Export for Maya is under development")

        # mayaExp_vrayProxy = exportSettings["vrayProxyExportMaya"]

        # export settings / Choices / Default Value:
        # exportType / 1 2 / 1
        # velocityOn / True False / True
        # velocityIntervalStart / 0.0 1.0 /0.0
        # velocityIntervalEnd / 0.0 1.0 /0.050
        # pointSize / 0.0 1.0 / 0.0
        # previewFaces / Integer / 10000
        # previewType / "clustering" "edge_collapse" "face_sampling" "combined" / "clustering"
        # vertexColorsOn / True False / False
        # ignoreHiddenObjects / True False / True
        # oneVoxelPerMesh / True False / False
        # facesPerVoxel / Integer / 20000
        # createProxyNode / True False / False
        # makeBackup / True False / False

        if not cmds.pluginInfo('vrayformaya.mll', l=True, q=True):
            try:
                cmds.loadPlugin('vrayformaya.mll')
            except:
                msg = "Vray cannot be initialized. Skipping Vray Proxy export"
                cmds.confirmDialog(title='Plugin Error', message=msg)
                return False

        originalSelection = cmds.ls(sl=True)
        if not exportSelected:
            cmds.SelectAll()

        # OVERRIDE ANIMATION SETTINGS
        if timeRange[0] != timeRange[1]:
            animOn = True
        else:
            animOn = False

        directory, name = os.path.split(filePath)
        proxyNode = "%s_proxy" % name

        cmds.vrayCreateProxy(dir=directory,
                             fname=name,
                             overwrite=True,
                             animOn=animOn,
                             animType=3,
                             startFrame=timeRange[0],
                             endFrame=timeRange[1],
                             node=proxyNode,
                             exportType=1,
                             makeBackup=False,
                             velocityOn=True,
                             velocityIntervalStart=0.0,
                             velocityIntervalEnd=0.050,
                             pointSize=0.0,
                             previewFaces=10000,
                             previewType="clustering",
                             vertexColorsOn=False,
                             ignoreHiddenObjects=True,
                             oneVoxelPerMesh=False,
                             facesPerVoxel=20000,
                             createProxyNode=False)

        # re-select original selection
        cmds.select(originalSelection)
        return False