Browse Source

MAJICK: Save the export properties...

pull/6/head
Adam Johnson 9 years ago
parent
commit
2ae0c5f7f8
  1. 72
      korman/operators/op_export.py

72
korman/operators/op_export.py

@ -14,8 +14,11 @@
# along with Korman. If not, see <http://www.gnu.org/licenses/>. # along with Korman. If not, see <http://www.gnu.org/licenses/>.
import bpy import bpy
from bpy.props import *
import os, os.path import os, os.path
from .. import exporter from .. import exporter
from ..properties.prop_world import PlasmaAge
class ExportOperator(bpy.types.Operator): class ExportOperator(bpy.types.Operator):
@ -24,27 +27,42 @@ class ExportOperator(bpy.types.Operator):
bl_idname = "export.plasma_age" bl_idname = "export.plasma_age"
bl_label = "Export Age" bl_label = "Export Age"
# Export specific props # Here's the rub: we define the properties in this dict. We're going to register them as a seekrit
version = bpy.props.EnumProperty( # over on the PlasmaAge world properties. We've got a helper so we can access them like they're actually on us...
name="Version", # If you want a volatile property, register it directly on this operator!
description="Version of the Plasma Engine to target", _properties = {
default="pvPots", # This should be changed when moul is easier to target! "version": (EnumProperty, {"name": "Version",
items=[ "description": "Version of the Plasma Engine to target",
("pvPrime", "Ages Beyond Myst (63.11)", "Targets the original Uru (Live) game", 2), "default": "pvPots", # This should be changed when moul is easier to target!
("pvPots", "Path of the Shell (63.12)", "Targets the most recent offline expansion pack", 1), "items": [("pvPrime", "Ages Beyond Myst (63.11)", "Targets the original Uru (Live) game", 2),
("pvMoul", "Myst Online: Uru Live (70)", "Targets the most recent online game", 0), ("pvPots", "Path of the Shell (63.12)", "Targets the most recent offline expansion pack", 1),
# I see no reason to even offer Myst 5... ("pvMoul", "Myst Online: Uru Live (70)", "Targets the most recent online game", 0)]}),
]
) "save_state": (BoolProperty, {"name": "Save State",
optimize = bpy.props.BoolProperty(name="Optimize Age", "description": "Saves your age's state to the server for subsequent link ins",
description="Optimizes your age to run faster. This slows down export.") "default": True}),
save_state = bpy.props.BoolProperty(name="Save State",
description="Saves your age's state to the server for subsequent link ins.", "use_texture_page": (BoolProperty, {"name": "Use Textures Page",
default=True) "description": "Exports all textures to a dedicated Textures page",
use_texture_page = bpy.props.BoolProperty(name="Use Texture Page", "default": True}),
description="Exports all textures to a dedicated Textures page", }
default=True)
filepath = bpy.props.StringProperty(subtype="FILE_PATH") # This wigs out and very bad things happen if it's not directly on the operator...
filepath = StringProperty(subtype="FILE_PATH")
def draw(self, context):
layout = self.layout
age = context.scene.world.plasma_age
# The crazy mess we're doing with props on the fly means we have to explicitly draw them :(
layout.prop(age, "version")
layout.prop(age, "save_state")
layout.prop(age, "use_texture_page")
def __getattr__(self, attr):
if attr in self._properties:
return getattr(bpy.context.scene.world.plasma_age, attr)
raise AttributeError(attr)
@property @property
def has_reports(self): def has_reports(self):
@ -89,6 +107,18 @@ class ExportOperator(bpy.types.Operator):
context.window_manager.fileselect_add(self) context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"} return {"RUNNING_MODAL"}
@classmethod
def register(cls):
# BEGIN MAJICK
# Register the exporter properties such that they will persist
for name, (prop, options) in cls._properties.items():
# Hide these settings from being seen on the age properties
age_options = dict(options)
age_options["options"] = {"HIDDEN"}
# Now do the majick
setattr(PlasmaAge, name, prop(**age_options))
# Add the export operator to the Export menu :) # Add the export operator to the Export menu :)
def menu_cb(self, context): def menu_cb(self, context):

Loading…
Cancel
Save