コード例 #1
0
ファイル: __init__.py プロジェクト: yazici/anima
    def set_system_units(self):
        """Sets the system units to studio defaults. Which is centimeters for
        distance and degree for angular units.

        :return:
        """
        import pymxs
        rt = pymxs.runtime
        metric = rt.name('metric')
        rt.units.SystemType = metric
        rt.units.DisplayType = metric
        rt.units.MetricType = rt.name('centimeters')
コード例 #2
0
ファイル: __init__.py プロジェクト: eoyilmaz/anima
    def set_system_units(self):
        """Sets the system units to studio defaults. Which is centimeters for
        distance and degree for angular units.

        :return:
        """
        import pymxs
        rt = pymxs.runtime
        metric = rt.name('metric')
        rt.units.SystemType = metric
        rt.units.DisplayType = metric
        rt.units.MetricType = rt.name('centimeters')
コード例 #3
0
def setSelectedObjVertexColor():
    rt.execute('max modify mode')
    s = list(rt.selection)
    if s != None and len(s) > 0:
        for nod in s:
            if HasEditPolyn(nod):
                rt.Select(nod)
                rt.subobjectLevel = 1
                rt.actionMan.executeAction( 0 ,"40021")
                nod.SetVertexColor(rt.color( 255, 255, 255), rt.name('VertexColor'))
                nod.SetVertexColor(rt.color( 255, 255, 255), rt.name('Illumination'))
                nod.SetVertexColor(rt.color(255,0,0), rt.name('Alpha'))
                rt.subobjectLevel = 0
                print("Obj {0} Finished".format(nod))
            else:
                print("OBJ {0} is not an Editable Poly, tool cannot perform vertex modifications".format(nod))
コード例 #4
0
def isExporterProcessing():
    try:
        vGlobal = rt.globalVars.get(rt.name("BabylonExporterStatus"))
        if vGlobal == "Unavailable":
            return True
        return False
    except:
        return False
コード例 #5
0
    def init(self):

        self.dir = mxs.getDir(mxs.name('publicExchangeStoreInstallPath'))
        ui_file = QFile(
            os.path.join(self.dir,  'AnimRef', 'Contents', 'interface', 'interface.ui'))
        ui_file.open(QFile.ReadOnly)
        self.ui = QUiLoader().load(ui_file, self)
        ui_file.close()
        layout = QtWidgets.QHBoxLayout()
        layout.addWidget(self.ui)
        layout.setMargin(4)
        self.setLayout(layout)
コード例 #6
0
def castIntToDotNetEnum(dotnetenum, index):
    '''
    Cast python int to dotnetobject enum
    \nin : 
    dotnetenum= str("dotnetenum") 
    index= int 
    \nout : 
    rt.dotNetObject 
    '''
    animExpType = rt.getPropNames(
        rt.execute('(dotnetclass "{0}")'.format(dotnetenum)))
    prop = rt.name(animExpType[index])
    command = '(dotnetclass "{0}").{1}'.format(dotnetenum, prop)
    return rt.execute(command)
コード例 #7
0
def sample():
    """Create all existing materials and showcase them."""
    def try_create(mat):
        """Try to create a given material. If not creatable return None."""
        try:
            return mat()
        except RuntimeError:
            return None

    rt.resetMaxFile(rt.Name('noPrompt'))
    # maximize the view (select a view with only the one viewport)
    rt.viewport.setLayout(rt.name("layout_1"))
    # show the material editor in basic mode
    rt.MatEditor.mode = rt.Name("basic")
    rt.MatEditor.open()
    # create a plane for the floor
    create_floor()
    # instantiate all materials that can be instantiated
    materials = filter(lambda x: x is not None,
                       map(try_create, rt.material.classes))
    # showcase all materials
    showcase_materials(list(materials))
コード例 #8
0
def _eval(string, silent=False):
    if not silent:
        _print("[HYPERSIM: _DATASET_EXPORT_SCENES] Executing MAXScript: " +
               string)
    return MaxPlus.Core.EvalMAXScript(string)


#
# parse command-line args
#

for k in rt.maxops.mxsCmdLineArgs.keys:
    _print('rt.maxops.mxsCmdLineArgs["' + k + '"] = ' +
           rt.maxops.mxsCmdLineArgs[k])

args_dataset_dir = rt.maxops.mxsCmdLineArgs[rt.name("dataset_dir")]

if rt.name("scene_names") in rt.maxops.mxsCmdLineArgs.keys:
    args_scene_names = rt.maxops.mxsCmdLineArgs[rt.name("scene_names")]
else:
    args_scene_names = None

assert os.path.exists(args_dataset_dir)

#
# parse dataset config
#

add_path_to_sys_path(args_dataset_dir,
                     mode="relative_to_cwd",
                     frame=inspect.currentframe())