Exemplo n.º 1
0
 def __init__(self, truck_file=None):
     #Load global RoR data definitions
     mxs.fileIn("rortools/_global/definitions.ms")
     parser = TruckParser.TruckParser()
     if truck_file is None:
         truck_file = mxs.getopenfilename()
     parser.load_truck(truck_file)
     
     object_holder = MaxObjHolder.MaxObjHolder()
     
     node_positions = ImportNodes.load_node_positions(parser.nodes, object_holder)
     
     ImportGlobalData.import_global_data(parser.truck_name, parser.global_data, object_holder)
     ImportBeams.import_beams(node_positions, parser.beams, parser.comments, parser.beam_defaults, object_holder)
     ImportCameras.import_cameras(node_positions, parser.cameras, object_holder)
     ImportCinecams.import_cinecams(node_positions, parser.cinecams, object_holder)
     ImportWheels.import_wheels(node_positions, parser.wheels, object_holder)
     ImportShocks.import_shocks(node_positions, parser.shocks, object_holder)
     ImportCommands.import_commands(node_positions, parser.commands, object_holder)
     ImportHydros.import_hydros(node_positions, parser.hydros, object_holder)
     ImportSlidenodes.import_slidenodes(node_positions, parser.slidenodes, object_holder)
     ImportSubmeshes.import_submeshes(node_positions, parser.submeshes, parser.cabs, parser.texcoords, parser.backmeshes, object_holder)
     ImportContacters.import_contacters(node_positions, parser.contacters, object_holder)
     ImportFixes.import_fixes(node_positions, parser.fixes, object_holder)
     object_holder.rotate_from_ror_to_max()
Exemplo n.º 2
0
    def __init__(self):
        mxs.fileIn("rortools/_global/definitions.ms")

        self.rotate_all_to_ror()

        data = ""
        data += self.export_global_data()
        data += self.export_nodes()  # This has the side effect of generating self.nodes

        data += self.export_beams()
        data += self.export_cameras()
        data += self.export_cinecams()
        data += self.export_wheels()
        data += self.export_shocks()
        data += self.export_commands()
        data += self.export_hydros()
        data += self.export_slidenodes()
        data += self.export_submeshes()
        data += self.export_contacters()
        data += self.export_fixes()
        data += "\nend\n"

        self.rotate_all_to_max()

        data = ColumnAligner.RoRColumnAligner().ror_align_by_column(data)

        print data
Exemplo n.º 3
0
 def _split_lines(self):
     """forces all the splines of an editable spline object to be one segment long
     the method is defined in pure maxscript, so if it is not defined then it needs to be
     loaded.
     """
     if not mxs.SplitBeam.__class__.__name__ == "value_wrapper":
         mxs.fileIn("rortools/RoRExporter/splitbeam.ms")
     mxs.SplitBeam(self.max_object)
Exemplo n.º 4
0
 def destroy_engine(self):
     """
     Called when the engine is shutting down
     """
     self.log_debug('%s: Destroying...' % self)
     
     # remove menu bar
     menu_script = os.path.join(self.disk_location, "resources", "destroy_menu_bar.ms")
     mxs.fileIn(menu_script)
Exemplo n.º 5
0
    def destroy_engine(self):
        """
        Called when the engine is shutting down
        """
        self.log_debug('%s: Destroying...' % self)

        # remove menu bar
        menu_script = os.path.join(self.disk_location, "resources",
                                   "destroy_menu_bar.ms")
        mxs.fileIn(menu_script)
Exemplo n.º 6
0
def init():
    packagedir = os.path.abspath(os.path.dirname(__file__))
    maxscriptfile = os.path.join(packagedir, "{{cookiecutter.name}}")
    importcommand = r'fileIn @"{0}"'.format(maxscriptfile)
    try:
        import MaxPlus
        MaxPlus.Core.EvalMAXScript(importcommand)
    except ImportError:
        try:
            from Py3dsMax import mxs
            mxs.fileIn(maxscriptfile)
        except ImportError:
            raise ImportError("Could not find a suitable "
                              "3ds Max Python backend.")
Exemplo n.º 7
0
 def post_app_init(self):
     """
     Called when all apps have initialized
     """
     # set TANK_MENU_BG_LOCATION needed by the maxscript.  The gamma correction applied to the
     # background images seems to have changed for 2012 & 2013 and then reverted back for 2014
     # which is why there are two versions!
     max_major_version = mxs.maxVersion()[0]
     menu_bg_name = "menu_bg_light.png" if max_major_version in [14000, 15000] else "menu_bg.png"
     os.environ["TANK_MENU_BG_LOCATION"] = os.path.join(self.disk_location, "resources", menu_bg_name)
     
     # now execute the max script to create a menu bar
     menu_script = os.path.join(self.disk_location, "resources", "menu_bar.ms")
     mxs.fileIn(menu_script)
     
     # set up menu handler
     tk_3dsmax = self.import_module("tk_3dsmax")
     self._menu_generator = tk_3dsmax.MenuGenerator(self)
Exemplo n.º 8
0
    def post_app_init(self):
        """
        Called when all apps have initialized
        """

        # set TANK_MENU_BG_LOCATION needed by the maxscript.  The gamma correction applied to the
        # background images seems to have changed for 2012 & 2013 and then reverted back for 2014
        # which is why there are two versions!
        max_major_version = mxs.maxVersion()[0]
        menu_bg_name = "menu_bg_light.png" if max_major_version in [
            14000, 15000
        ] else "menu_bg.png"
        os.environ["TANK_MENU_BG_LOCATION"] = os.path.join(
            self.disk_location, "resources", menu_bg_name)

        # now execute the max script to create a menu bar
        menu_script = os.path.join(self.disk_location, "resources",
                                   "menu_bar.ms")
        mxs.fileIn(menu_script)

        # set up menu handler
        tk_3dsmax = self.import_module("tk_3dsmax")
        self._menu_generator = tk_3dsmax.MenuGenerator(self)

        # set up a qt style sheet
        # note! - try to be smart about this and only run
        # the style setup once per session - it looks like
        # 3dsmax slows down if this is executed every engine restart.
        qt_app_obj = tank.platform.qt.QtCore.QCoreApplication.instance()
        curr_stylesheet = qt_app_obj.styleSheet()

        if "toolkit 3dsmax style extension" not in curr_stylesheet:

            self._initialize_dark_look_and_feel()

            # note! For some reason it looks like the widget background color isn't being set correctly
            # on 3dsmax top level items. In order to mitigate this, apply a style to set the background
            # color on the main app window area. The main app window area is typically a QWidget which
            # is a child of a QDialog (created by tk-core) with the name TankDialog. Based on this,
            # we can construct a style directive QDialog#TankDialog > QWidget which applies to the
            # immediate QWidget children only.
            curr_stylesheet += "\n\n /* toolkit 3dsmax style extension */ \n\n"
            curr_stylesheet += "\n\n QDialog#TankDialog > QWidget { background-color: #343434; }\n\n"
            qt_app_obj.setStyleSheet(curr_stylesheet)
Exemplo n.º 9
0
    def post_app_init(self):
        """
        Called when all apps have initialized
        """
        # set TANK_MENU_BG_LOCATION needed by the maxscript.  The gamma correction applied to the
        # background images seems to have changed for 2012 & 2013 and then reverted back for 2014
        # which is why there are two versions!
        max_major_version = mxs.maxVersion()[0]
        menu_bg_name = "menu_bg_light.png" if max_major_version in [
            14000, 15000
        ] else "menu_bg.png"
        os.environ["TANK_MENU_BG_LOCATION"] = os.path.join(
            self.disk_location, "resources", menu_bg_name)

        # now execute the max script to create a menu bar
        menu_script = os.path.join(self.disk_location, "resources",
                                   "menu_bar.ms")
        mxs.fileIn(menu_script)

        # set up menu handler
        tk_3dsmax = self.import_module("tk_3dsmax")
        self._menu_generator = tk_3dsmax.MenuGenerator(self)