Newton's Enigma Export

Published February 14, 2010
Advertisement


Today I have been working on an export script for Blender based on the Collada exporter. A lot of the code up until this point has been a straight port/simplification and I am in the process of refactoring the code to match my coding style. I am reducing the complexity of the plugin quite a bit because I don't need many fancy options. I will add more complexity later if I need it!

Here is the code I am working on currently:

#!BPY"""Name: 'Newtons Enigma Physics (.nep) ... 'Blender: 249Group: 'Export'Tooltip: 'Export physics from Blender to Newtons Enigma Physics format (.nep)'"""__author__ = "Donald May"__url__ = ("Project homepage, http://www.m2-t2.com")__version__ = "0.1.0"__email__ = "donald@m2-t2.com"__bpydoc__ ="""Description: Exports Blender Physics to Newtons Enigma Physics format.Usage: Run the script from the menu or inside Blender."""# --------------------------------------------------------------------------# Newton's Enigma Physics plugin for Blender# --------------------------------------------------------------------------# ***** BEGIN GPL LICENSE BLOCK *****## Copyright (C) 2010: Donald May## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License,# or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software Foundation,# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## ***** END GPL LICENCE BLOCK *****# --------------------------------------------------------------------------import sysimport Blenderclass NEPhysExporter:    def __init__(self):        self.file_button = None        self.file_name = ""        Blender.Draw.Register(self.draw_gui, self.gui_event, self.button_event)        Blender.Window.RedrawAll()            def draw_gui(self):        Blender.BGL.glClearColor(0.75,0.75,0.91,1)        Blender.BGL.glClear(Blender.BGL.GL_COLOR_BUFFER_BIT)        size = Blender.Window.GetAreaSize()        Blender.BGL.glColor3f(0.255,0.255,0.2)        Blender.BGL.glRasterPos2i(45, size[1]-30)        Blender.Draw.Text("Newton's Enigma Physics Export Plugin for Blender", "large")         Blender.BGL.glRasterPos2i(45, size[1]-40)        Blender.Draw.Text("Version: %s"%(__version__),"small")        self.draw_file_selector(size)            def draw_file_selector(self, size):        Blender.BGL.glColor3f(0.9,0.08,0.08)        Blender.BGL.glRasterPos2i(45, size[1]-95)        Blender.Draw.Text("Export", "normal")            Blender.BGL.glColor3f(0.255,0.255,0.2)            # Create File path input            yval = size[1] - 130        Blender.BGL.glRasterPos2i(45, yval)        if self.file_button is None or self.file_button.val == '':            self.file_name = ""        else:            self.file_name = self.fileButton.val            Blender.Draw.Text('Export file:',"normal")        max_width = 400        if size[0] - (105 + 35) > max_width:            file_width = max_width        else:            file_width = size[0] - (105 + 35)                                self.file_button = Blender.Draw.String('', 5, 105, yval-5, file_width, 20, self.file_name, 255)         Blender.Draw.PushButton('...', 2, 105 + file_width, yval-5, 30, 20, 'browse file')            Blender.Draw.PushButton("Cancel", 3, 45, yval-35, 55, 20, "Cancel")        Blender.Draw.PushButton('Export and Close', 4, 45+55+35, yval-35, 100, 20, 'Export and close this screen')        def gui_event(self, evt, val):        pass            def button_event(self, evt):        pass            phys_exporter = NEPhysExporter()
Previous Entry A box is a box
Next Entry UDK
0 likes 1 comments

Comments

zarfius
You haven't posted for a while? How's it going?
March 02, 2010 11:05 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

Finished!

1608 views

Progress

1672 views

Resolve

1693 views

GUI

1851 views

Making a menu

2276 views

Teddystein!

1768 views

Doodles

1574 views

Tool overview

2153 views

Welcome!

1428 views
Advertisement