Everything related to SDK.
User avatar
By seghier
#395327
Hello ; i tried to convert "change material script" to standalone executable ;
the open button load all materials in the scene and than with double click we can select one of them and the name appear next to replace button
the new scene saved but nothing change ; the materials are the same and the function add 19 new empty materials have the same name of the new material.

Image
Code: Select all
from pymaxwell import *
import sys
import os
from PyQt4 import QtCore, QtGui, uic

import change_mxm

uifile = 'F:/qtdesigner/maxwell script/maxwell tool/change mxm/change_mxm.ui'

Ui_MainWindow, QtBaseClass = uic.loadUiType(uifile)

class MyApp(QtGui.QMainWindow, change_mxm.Ui_MainWindow):

    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)

###########################################################################################
    #buttons:
        self.input_load_mxm
        self.output_save_scene
        self.open_old_scene.clicked.connect(self.openMxs)
        self.save_new_scene.clicked.connect(self.save)
        self.Open_mxm.clicked.connect(self.openMxm)
        self.replace_mxm.clicked.connect(self.changeMaterialFromMXM)
        self.mxm_item

###########################################################################################
    def errorMessageOpen(self):
        input = self.input_mxs_scene.text().toAscii().data()
        if len(input) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Choose MXS Scene ', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def errorMessageSave(self):
        input = self.output_save_scene.text().toAscii().data()
        if len(input) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Save MXS Scene ', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def openMxs(self):
        inPath = QtGui.QFileDialog.getOpenFileName(self, 'Open file', 'C:/', filter='*.mxs');
        self.input_mxs_scene.setText(inPath);
        self.mxm_list.clear()
        if not self.errorMessageOpen():
            return;
        # loop over all mxs
        mxsList = self.input_mxs_scene.text().toAscii().data()
        scene = Cmaxwell(mwcallback);
        ok = scene.readMXS(mxsList);
        sceneMaterials = scene.getMaterialNames();
        materialcount = int(scene.getMaterialsCount()[0])
        for name in sceneMaterials:
            scenematerial = scene.getMaterial(name)
            #print scenematerial
            self.mxm_list.addItem(name)
        self.mxm_list.itemActivated.connect(self.printItemText)
        #print self.mxm_list.count()
###########################################################################################
    # loop over all objects in the scene
    def changeMaterialFromMXM(self):
        mxsList = self.input_mxs_scene.text().toAscii().data()
        scene = Cmaxwell(mwcallback);
        ok = scene.readMXS(mxsList);
        for mxs in mxsList:
            oldMatName = str(self.mxm_item.text())
            print oldMatName
            newMatPath = self.input_load_mxm.text().toAscii().data()
            print newMatPath

            oldMat = scene.getMaterial(oldMatName)
            newMatName, descr, im, ok = CmaxwellMaterial.getMxmInfo(newMatPath)
            newMat = scene.createMaterial(newMatName)

            it = CmaxwellObjectIterator()
            obj = it.first(scene)

            while not obj.isNull():

                # update object material

                objMat = obj.getMaterial()[0]
                if not objMat.isNull():
                    objMat.getName()
                    if objMat.getName() == oldMatName:
                        obj.setMaterial(newMat)

                # update triangle group material

                itGroup = CmaxwellObjectTrianglesGroupIterator()
                group = itGroup.first(obj)

                while not group.isNull():

                    # get group material from the 1st triangle of the group

                    triangles = group.getTriangles()
                    groupMat = obj.getTriangleMaterial(triangles[0])[0]

                    if groupMat.getName() == oldMatName:
                        group.setMaterial(newMat)

                    group = itGroup.next()

                obj = it.next()

            outputpath = self.output_save_scene.text().toAscii().data()
            scene.writeMXS(outputpath)
            #if not scene.writeMXS(outputpath):
                #print('ERROR: cannot save ' + outputpath)
                #return 0

        #return 1

################################################################################################

    def printItemText(self, item):
        self.mxm_item.setText(str(item.text()))


    def save(self):
        outmxs = QtGui.QFileDialog.getSaveFileName(self, 'saveFlle', 'C:/', filter='Maxwell Scene (*.mxs)');
        filepath = os.path.splitext(outmxs.toAscii().data())[0]
        file_ext = os.path.splitext(outmxs.toAscii().data())[1]
        outmxs_new = filepath + '_modified' + file_ext
        if len(filepath) == 0:
            self.output_save_scene.setText
            self.output_save_scene.clear()
            if not self.errorMessageSave():
                return;
        else:
            self.output_save_scene.setText(outmxs_new)

    def openMxm(self):
        inPath = QtGui.QFileDialog.getOpenFileName(self, 'Open file', 'C:/', filter='*.mxm');
        self.input_load_mxm.setText(inPath);
        #self.mxm_list.clear()


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    window = MyApp()
    oldMatName = 'choose from list'
    newMatPath = 'new material'
    mxsList = ['input mxs scene']
    outPath = 'save scene'
    window.show()
    sys.exit(app.exec_())
User avatar
By seghier
#395331
problem fixed and for a simple scene like the script the material changed without problem but with complex scene i get this error:
Warning: Warning in Method = Cobject::CtrianglesGroup::Citerator::first
error = Current object is not a mesh
---
the scene have many instances ; maybe this is the problem ?
Code: Select all
from pymaxwell import *
import sys
import os
from PyQt4 import QtCore, QtGui, uic

import change_mxm

uifile = 'F:/qtdesigner/maxwell script/maxwell tool/change mxm/change_mxm.ui'

Ui_MainWindow, QtBaseClass = uic.loadUiType(uifile)

class MyApp(QtGui.QMainWindow, change_mxm.Ui_MainWindow):

    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)

###########################################################################################
    #buttons:
        self.input_load_mxm
        self.output_save_scene
        self.open_old_scene.clicked.connect(self.openMxs)
        self.save_new_scene.clicked.connect(self.save)
        self.Open_mxm.clicked.connect(self.openMxm)
        self.replace_mxm.clicked.connect(self.changeMaterialFromMXM)
        self.mxm_item

###########################################################################################
    def errorMessageOpen(self):
        input = self.input_mxs_scene.text().toAscii().data()
        if len(input) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Choose MXS Scene ', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def errorMessageSave(self):
        input = self.output_save_scene.text().toAscii().data()
        if len(input) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Save MXS Scene ', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def openMxs(self):
        inPath = QtGui.QFileDialog.getOpenFileName(self, 'Open file', 'C:/', filter='*.mxs');
        self.input_mxs_scene.setText(inPath);
        self.mxm_list.clear()
        if not self.errorMessageOpen():
            return;
        # loop over all mxs
        mxsList = self.input_mxs_scene.text().toAscii().data()
        scene = Cmaxwell(mwcallback);
        ok = scene.readMXS(mxsList);
        sceneMaterials = scene.getMaterialNames();
        materialcount = int(scene.getMaterialsCount()[0])
        for name in sceneMaterials:
            scenematerial = scene.getMaterial(name)
            #print scenematerial
            self.mxm_list.addItem(name)
        self.mxm_list.itemActivated.connect(self.printItemText)
        #print self.mxm_list.count()
###########################################################################################
    # loop over all objects in the scene
    def changeMaterialFromMXM(self):

        oldMatName = self.mxm_item.text().toAscii().data()
        newMatPath = self.input_load_mxm.text().toAscii().data()
        mxsList = [self.input_mxs_scene.text().toAscii().data()]
        outPath = self.output_save_scene.text().toAscii().data()

        scene = Cmaxwell(mwcallback);

        for mxs in mxsList:
            scene.readMXS(mxs)

            oldMat = scene.getMaterial(oldMatName)
            newMatName, descr, im, ok = CmaxwellMaterial.getMxmInfo(newMatPath)
            newMat = scene.createMaterial(newMatName)
            newMat.read(newMatPath)

            it = CmaxwellObjectIterator()
            obj = it.first(scene)

            while not obj.isNull():

                objMat = obj.getMaterial()[0]
                if not objMat.isNull():
                    if objMat.getName() == oldMatName:
                        obj.setMaterial(newMat)
                        print('  UPDATED -> ' + newMatName)

                itGroup = CmaxwellObjectTrianglesGroupIterator()
                group = itGroup.first(obj)

                while not group.isNull():

                    triangles = group.getTriangles()
                    groupMat = obj.getTriangleMaterial(triangles[0])[0]

                    if groupMat.getName() == oldMatName:
                        group.setMaterial(newMat)

                    group = itGroup.next()

                obj = it.next()

            scene.writeMXS(outPath)

################################################################################################

    def printItemText(self, item):
        self.mxm_item.setText(str(item.text()))


    def save(self):
        outmxs = QtGui.QFileDialog.getSaveFileName(self, 'saveFlle', 'C:/', filter='Maxwell Scene (*.mxs)');
        filepath = os.path.splitext(outmxs.toAscii().data())[0]
        file_ext = os.path.splitext(outmxs.toAscii().data())[1]
        outmxs_new = filepath + '_modified' + file_ext
        if len(filepath) == 0:
            self.output_save_scene.setText
            self.output_save_scene.clear()
            if not self.errorMessageSave():
                return;
        else:
            self.output_save_scene.setText(outmxs_new)

    def openMxm(self):
        inPath = QtGui.QFileDialog.getOpenFileName(self, 'Open file', 'C:/', filter='*.mxm');
        self.input_load_mxm.setText(inPath);
        #self.mxm_list.clear()


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    window = MyApp()
    oldMatName = 'choose from list'
    newMatPath = 'new material'
    mxsList = ['input mxs scene']
    outPath = 'save scene'
    window.show()
    sys.exit(app.exec_())
User avatar
By Brany
#395347
Triangle groups are from a "mesh" object. "instance" objects doesn't have such as data.

You can do something like this:
Code: Select all
ismesh,ok = obj.isMesh()
if ismesh:
    itGroup = CmaxwellObjectTrianglesGroupIterator()
    group = itGroup.first(obj)
User avatar
By seghier
#395363
hello
the code to change material work fine in pycharm and replace the material than save scene without errors
the executable don't save anything ! i don't understand why
video : https://www.dropbox.com/s/s4fyp2eowqn4v ... m.mp4?dl=0
the code :
Code: Select all
from pymaxwell import *
import sys
import os
from PyQt4 import QtGui, uic
import replace_mxm

uifile = 'F:/replace mxm/replace_mxm.ui'

Ui_MainWindow, QtBaseClass = uic.loadUiType(uifile)

class MyApp(QtGui.QMainWindow, replace_mxm.Ui_MainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)

        # buttons mxm:
        self.open_old_scene.clicked.connect(self.MXMopenMxs)
        self.save_new_scene.clicked.connect(self.MXMsave)
        self.Open_mxm.clicked.connect(self.MXMopenMxm)
        self.replace_mxm.clicked.connect(self.MXMchangeMaterialFromMXM)
        self.mxm_clear.clicked.connect(self.MXMclear)

###########################################################################################

        # replace mxm tab

###########################################################################################

    def errorMessageOpen(self):
        listCount = self.mxm_list.count()
        input = self.input_mxs_scene.text().toAscii().data()
        if len(input) == 0 and listCount == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Open MXS Scene', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def errorMessageSave(self):
        input = self.output_save_scene.text().toAscii().data()
        if len(input) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Save MXS Scene', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def errorMessageReplace(self):
        openMxs = self.input_mxs_scene.text().toAscii().data()
        openMxm = self.input_load_mxm.text().toAscii().data()
        saveScene = self.output_save_scene.text().toAscii().data()

        if len(openMxs) == 0 and len(openMxm) == 0 and len(saveScene) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Fill the Fields', QtGui.QMessageBox.Ok);

            return False;
        return True;

    def errorMessageOpenMXM(self):
        mxminput = self.input_load_mxm.text().toAscii().data()
        if len(mxminput) == 0:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Open MXM File', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def errorMessageMxm(self):
        mxmName = 'MXM from the list'
        if self.mxm_item.text() == mxmName:
            msg = QtGui.QMessageBox.warning(self, 'Warning', 'Choose MXM from the list', QtGui.QMessageBox.Ok);
            return False;
        return True;

    def MXMclear(self):
        self.input_load_mxm.clear()
        self.input_mxs_scene.clear()
        self.output_save_scene.clear()
        self.mxm_item.setText('MXM from the list')
        self.mxm_list.clear()

###########################################################################################
    def MXMopenMxs(self):
        inPath = QtGui.QFileDialog.getOpenFileName(self, 'Open file', 'C:/', filter='*.mxs');
        self.input_mxs_scene.setText(inPath);
        self.mxm_list.clear()
        if len(inPath) == 0:
           self.mxm_item.setText('MXM from the list')
        if not self.errorMessageOpen():
            return;
        # loop over all mxs
        mxsList = self.input_mxs_scene.text().toAscii().data()
        scene = Cmaxwell(mwcallback);
        ok = scene.readMXS(mxsList);
        sceneMaterials = scene.getMaterialNames();
        materialcount = int(scene.getMaterialsCount()[0])
        for name in sceneMaterials:
            scenematerial = scene.getMaterial(name)
            #print scenematerial
            self.mxm_list.addItem(name)
        self.mxm_list.itemActivated.connect(self.printItemText)
        #print self.mxm_list.count()
###########################################################################################
    # loop over all objects in the scene
    def MXMchangeMaterialFromMXM(self):
        oldMatName = self.mxm_item.text().toAscii().data()
        newMatPath = self.input_load_mxm.text().toAscii().data()
        mxsList = [self.input_mxs_scene.text().toAscii().data()]
        outPath = self.output_save_scene.text().toAscii().data()

        if not self.errorMessageReplace():
            return;
        if not self.errorMessageOpenMXM():
            return;
        if not self.errorMessageOpen():
            return;
        if not self.errorMessageSave():
            return;
        if not self.errorMessageMxm():
            return;

        scene = Cmaxwell(mwcallback);
        for mxs in mxsList:
            scene.readMXS(mxs)

            #oldMat = scene.getMaterial(oldMatName)
            newMatName, descr, im, ok = CmaxwellMaterial.getMxmInfo(newMatPath)
            newMat = scene.createMaterial(newMatName)
            newMat.read(newMatPath)

            it = CmaxwellObjectIterator()
            obj = it.first(scene)

            while not obj.isNull():
                objMat = obj.getMaterial()[0]
                if not objMat.isNull():
                    if objMat.getName() == oldMatName:
                        obj.setMaterial(newMat)
                        print('  UPDATED -> ' + newMatName)
                ismesh, ok = obj.isMesh()
                if ismesh:
                    itGroup = CmaxwellObjectTrianglesGroupIterator()
                    group = itGroup.first(obj)

                    while not group.isNull():

                        triangles = group.getTriangles()
                        groupMat = obj.getTriangleMaterial(triangles[0])[0]

                        if groupMat.getName() == oldMatName:
                            group.setMaterial(newMat)

                        group = itGroup.next()

                obj = it.next()

        scene.writeMXS(outPath)


################################################################################################

    def printItemText(self, item):
        self.mxm_item.setText(str(item.text()))

    def MXMsave(self):
        outmxs = QtGui.QFileDialog.getSaveFileName(self, 'saveFlle', 'C:/', filter='Maxwell Scene (*.mxs)');
        filepath = os.path.splitext(outmxs.toAscii().data())[0]
        file_ext = os.path.splitext(outmxs.toAscii().data())[1]
        outmxs_new = filepath + '_updated' + file_ext
        if len(filepath) == 0:
            self.output_save_scene.setText()
            self.output_save_scene.clear()
            if not self.errorMessageSave():
                return;
        else:
            self.output_save_scene.setText(outmxs_new)

    def MXMopenMxm(self):
        inPath = QtGui.QFileDialog.getOpenFileName(self, 'Open file', 'C:/', filter='*.mxm');
        self.input_load_mxm.setText(inPath);
        #self.mxm_list.clear()

################################################################################################

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    style = QtGui.QApplication.setStyle('Plastique')
    window = MyApp()
    window.show()
    sys.exit(app.exec_())
User avatar
By seghier
#395369
i change the code to write the name of the material like the original one from scripts folder
the scene have two materials : a and b
when i choose one of them the new scene don't created but when i choose any letters or leave the field empty the new scene saved with new material added (in this case leather )
video : https://www.dropbox.com/s/bl9jic8ja4d95 ... 2.mp4?dl=0
User avatar
By Brany
#395431
Yes, but it is a little bit trickier. Example code to set all MaxwellGrass modifiers' material:
Code: Select all
from pymaxwell import *
import os

def changeGrassMaterial(inPath,outPath,newMaterialName):
  scene = Cmaxwell(mwcallback)
  if not scene.readMXS(inPath):
    print('Error reading '+inPath)
    return 0
  
  material = scene.getMaterial(newMaterialName)
  if material.isNull():
    print('Error: material %s not exists' % newMaterialName)
    return 0
  
  mgr = CextensionManager.instance()
  mgr.loadAllExtensions()
  
  oit = CmaxwellObjectIterator()
  object = oit.first(scene)
  while not object.isNull():
    nModifiers,ok = object.getGeometryModifierExtensionsNumber()
    for i in range(nModifiers):
      modifierParams,ok = object.getGeometryModifierExtensionParamsAtIndex(i)
      name,ok = modifierParams.getString('EXTENSION_NAME')
      print name
      if name == 'MaxwellGrass':
        for j in range(modifierParams.getNumItems()):
          param = modifierParams.getByIndex(j)
          print('-------------------------')
          print param
          if param[0] == 'Material':
            modifierParams.setString('Material',newMaterialName)
            print('New value:')
            print modifierParams.getByIndex(j)
    object = oit.next()
  
  if not scene.writeMXS(outPath):
    print("Cannot write "+outPath)
    return 0
  
  print(outPath)
  return 1

### MAIN ###

if __name__ == "__main__":
	inPath = 'G:/scenes/4.1/grass.mxs'
	outPath = 'G:/scenes/4.1/grass_edit.mxs'
	changeGrassMaterial(inPath,outPath,'green')
User avatar
By seghier
#395434
hi Brany ; i modify the code a little bit
Code: Select all
from pymaxwell import *
import os

def changeGrassMaterial(inPath,outPath,oldMat,newMat):
  scene = Cmaxwell(mwcallback)
  if not scene.readMXS(inPath):
    print('Error reading '+inPath)
    return 0
  
  material = scene.getMaterial(oldMat)
  if material.isNull():
    print('Error: material %s not exists' % oldMat)
    return 0
  
  mgr = CextensionManager.instance()
  mgr.loadAllExtensions()
  
  oit = CmaxwellObjectIterator()
  object = oit.first(scene)
  while not object.isNull():
    nModifiers,ok = object.getGeometryModifierExtensionsNumber()
    for i in range(nModifiers):
      modifierParams,ok = object.getGeometryModifierExtensionParamsAtIndex(i)
      name,ok = modifierParams.getString('EXTENSION_NAME')
      print name
      if name == 'MaxwellGrass':
        for j in range(modifierParams.getNumItems()):
          param = modifierParams.getByIndex(j)
          print('-------------------------')
          print param
          if param[0] == 'Material':
            modifierParams.setString('Material',newMat)
            print('New value:')
            print modifierParams.getByIndex(j)
    object = oit.next()
  
  if not scene.writeMXS(outPath):
    print("Cannot write "+outPath)
    return 0
  
  print(outPath)
  return 1

### MAIN ###

if __name__ == "__main__":
	newMat = 'c:/input/leather.mxm'
	oldMat = 'grass'
	inPath = 'c:/input/t.mxs'
	outPath = 'c:/intest/t_edit.mxs'
	changeGrassMaterial(inPath,outPath,oldMat,newMat)
User avatar
By Brany
#395450
hI seghier,
seghier wrote:
Thu Sep 14, 2017 4:15 pm
hi Brany ; i modify the code a little bit
Code: Select all
from pymaxwell import *
import os

def changeGrassMaterial(inPath,outPath,oldMat,newMat):
  scene = Cmaxwell(mwcallback)
  if not scene.readMXS(inPath):
    print('Error reading '+inPath)
    return 0
  
  material = scene.getMaterial(oldMat)
  if material.isNull():
    print('Error: material %s not exists' % oldMat)
    return 0
  
  mgr = CextensionManager.instance()
  mgr.loadAllExtensions()
  
  oit = CmaxwellObjectIterator()
  object = oit.first(scene)
  while not object.isNull():
    nModifiers,ok = object.getGeometryModifierExtensionsNumber()
    for i in range(nModifiers):
      modifierParams,ok = object.getGeometryModifierExtensionParamsAtIndex(i)
      name,ok = modifierParams.getString('EXTENSION_NAME')
      print name
      if name == 'MaxwellGrass':
        for j in range(modifierParams.getNumItems()):
          param = modifierParams.getByIndex(j)
          print('-------------------------')
          print param
          if param[0] == 'Material':
            modifierParams.setString('Material',newMat)
            print('New value:')
            print modifierParams.getByIndex(j)
    object = oit.next()
  
  if not scene.writeMXS(outPath):
    print("Cannot write "+outPath)
    return 0
  
  print(outPath)
  return 1

### MAIN ###

if __name__ == "__main__":
	newMat = 'c:/input/leather.mxm'
	oldMat = 'grass'
	inPath = 'c:/input/t.mxs'
	outPath = 'c:/intest/t_edit.mxs'
	changeGrassMaterial(inPath,outPath,oldMat,newMat)
this wont work because the "Material" param of the "MaxwellGrass" extension expects the material name of an existing material in the scen, not a MXM path. If you want to use a MXM material path, you have to create a new material in the scene, and set the MXM reference:
Code: Select all
material = scene.createMaterial('my material',True);
if not material.setReference(True,newMat):
  print('Error importing MXM')
  return 0
User avatar
By seghier
#395458
the new material is reference and have the full name of the path
i rename it but how i can assign it to the grass ?
Code: Select all
from pymaxwell import *
import os

def changeGrassMaterial(inPath,outPath,oldMat,newMat):
  scene = Cmaxwell(mwcallback)
  if not scene.readMXS(inPath):
    print('Error reading '+inPath)
    return 0
  
  material1 = scene.getMaterial(oldMat)
  if material1.isNull():
    print('Error: material %s not exists' % oldMat)
    return 0

  material2 = scene.createMaterial(newMat,True);
  if not material2.setReference(True,newMat):
    print('Error importing MXM')
    return 0

  material3 = scene.getMaterial(newMat)
  if material3.isNull():
     print('Error: material %s not exists' % newMat)
     return 0
  
  mat_name = material3.getName()
  print mat_name
  if mat_name == newMat:
      material3.setName('new_Mat')

  mgr = CextensionManager.instance()
  mgr.loadAllExtensions()
  
  oit = CmaxwellObjectIterator()
  object = oit.first(scene)
  while not object.isNull():
    nModifiers,ok = object.getGeometryModifierExtensionsNumber()
    for i in range(nModifiers):
      modifierParams,ok = object.getGeometryModifierExtensionParamsAtIndex(i)
      name,ok = modifierParams.getString('EXTENSION_NAME')
      #print name
      if name == 'MaxwellGrass':
        for j in range(modifierParams.getNumItems()):
          param = modifierParams.getByIndex(j)
          #print('-------------------------')
          #print param
          if param[0] == 'Material':
            modifierParams.setString('Material',newMat)
            #print('New value:')
            #print modifierParams.getByIndex(j)
    object = oit.next()
  
  if not scene.writeMXS(outPath):
    print("Cannot write "+outPath)
    return 0
  
  print(outPath)
  return 1

### MAIN ###

if __name__ == "__main__":
	newMat = 'c:/input/leather.mxm'
	oldMat = 'grass'
	inPath = 'c:/input/t.mxs'
	outPath = 'c:/intest/t_edit.mxs'
	changeGrassMaterial(inPath,outPath,oldMat,newMat)

I think that most features that are needed on a re[…]

Maxwell keeps returning an error when I try to ren[…]

Hello good day! I wanted to know if you can help[…]

I chose a new default folder location for the Maxw[…]