def LaunchPly2Vrmesh(vrsceneFilepath, vrmeshFilepath=None, nodeName=None, frames=None, applyTm=False, useVelocity=False, previewOnly=False, previewFaces=None): ply2vrmeshBin = "ply2vrmesh{arch}{ext}" ply2vrmeshArch = "" if sys.platform == 'win32': ply2vrmeshExt = ".exe" ply2vrmeshArch = "_%s" % SysUtils.GetArch() elif sys.platform == 'linux': ply2vrmeshExt = ".bin" else: ply2vrmeshExt = ".mach" ply2vrmeshBin = ply2vrmeshBin.format(arch=ply2vrmeshArch, ext=ply2vrmeshExt) exporterPath = SysUtils.GetExporterPath() if not exporterPath: return "Exporter path is not found!" ply2vrmesh = os.path.join(exporterPath, "bin", ply2vrmeshBin) if not os.path.exists(ply2vrmesh): return "ply2vrmesh binary not found!" cmd = [ply2vrmesh] cmd.append(vrsceneFilepath) if previewFaces: cmd.append('-previewFaces') cmd.append('%i' % previewFaces) if previewOnly: cmd.append('-vrscenePreview') if nodeName: cmd.append('-vrsceneNodeName') cmd.append(nodeName) if useVelocity: cmd.append('-vrsceneVelocity') if applyTm: cmd.append('-vrsceneApplyTm') if frames is not None: cmd.append('-vrsceneFrames') cmd.append('%i-%i' % (frames[0], frames[1])) if vrmeshFilepath is not None: cmd.append(vrmeshFilepath) debug.PrintInfo("Calling: %s" % " ".join(cmd)) err = subprocess.call(cmd) if err: return "Error generating vrmesh file!" return None
def execute(self, context): # Check if target dir is writable exporterDir = SysUtils.GetExporterPath() if not os.access(exporterDir, os.W_OK): self.report({'ERROR'}, "Exporter directory is not writable!") return {'CANCELLED'} git = shutil.which("git") if not git: if sys.platform == 'win32': # Try default paths gitPaths = ( 'C:/Program Files/Git/bin/git.exe', 'C:/Program Files (x86)/Git/bin/git.exe', ) for _git in gitPaths: if os.path.exists(_git): git = _git break if not git: self.report({'ERROR'}, "Git is not found!") return {'CANCELLED'} if sys.platform == 'win32': git = '"%s"' % git cmds = ("%s fetch" % git, "%s reset --hard origin/master" % git, "%s submodule foreach git fetch" % git, "%s submodule foreach git reset --hard origin/master" % git) os.chdir(exporterDir) err = 0 for cmd in cmds: debug.PrintInfo("Executing: %s" % cmd) err += os.system(cmd) if err: self.report( {'WARNING'}, "V-Ray For Blender: Git update warning! Check system console!") return {'CANCELLED'} self.report({ 'INFO' }, "V-Ray For Blender: Exporter is now updated! Please, restart Blender!" ) return {'FINISHED'}
def draw(self, context): presetPaths = { os.path.join(SysUtils.GetExporterPath(), "presets", self.preset_subdir), os.path.join(SysUtils.GetUserConfigDir(), "presets", self.preset_subdir), } paths = [] for path in presetPaths: if os.path.exists(path): paths.append(path) if hasattr(self, 'menu_item_save') and self.menu_item_save: op = self.layout.operator('vray.export_asset', text="Save Selected", icon='FILE_TICK') op.asset_type = self.preset_subdir self.layout.separator() self.path_menu(paths)
def init(): jsonDirpath = os.path.join(SysUtils.GetExporterPath(), "plugins_desc") _vray_for_blender.start(jsonDirpath) if HAS_VB35: _vray_for_blender_rt.load(jsonDirpath)
def GetPluginsDir(): return os.path.join(SysUtils.GetExporterPath(), "plugins")