diff --git a/korman/__init__.py b/korman/__init__.py index a655f96..60f41bf 100644 --- a/korman/__init__.py +++ b/korman/__init__.py @@ -20,14 +20,15 @@ from . import operators, properties, ui bl_info = { "name": "Korman", "author": "Guild of Writers", - "blender": (2, 67, 0), # I can't be bothered to support old stuff + "blender": (2, 67, 0), # I can't be bothered to support old stuff "location": "File > Import-Export", "description": "Exporter for Cyan Worlds' Plasma Engine", "warning": "alpha", - "category": "System", # Eventually, we will hide some of the default - # Blender panels (think materials) + "category": "System", # Eventually, we will hide some of the default + # Blender panels (think materials) } + def register(): """Registers all Blender operators and GUI items in Korman""" @@ -38,6 +39,7 @@ def register(): operators.register() properties.register() + def unregister(): """Unregisters all Blender operators and GUI items""" bpy.utils.unregister_module(__name__) diff --git a/korman/operators/op_export.py b/korman/operators/op_export.py index f41d0ba..148ff9e 100644 --- a/korman/operators/op_export.py +++ b/korman/operators/op_export.py @@ -17,6 +17,7 @@ import bpy import os, os.path from .. import exporter + class ExportOperator(bpy.types.Operator): """Exports ages for Cyan Worlds' Plasma Engine""" @@ -28,7 +29,7 @@ class ExportOperator(bpy.types.Operator): version = bpy.props.EnumProperty( name="Version", description="Version of the Plasma Engine to target", - default="pvPots", # This should be changed when moul is easier to target! + default="pvPots", # This should be changed when moul is easier to target! items=[ ("pvPrime", "Ages Beyond Myst (63.11)", "Targets the original Uru (Live) game", 2), ("pvPots", "Path of the Shell (63.12)", "Targets the most recent offline expansion pack", 1), @@ -91,5 +92,7 @@ def menu_cb(self, context): if context.scene.render.engine == "PLASMA_GAME": self.layout.operator_context = "INVOKE_DEFAULT" self.layout.operator(ExportOperator.bl_idname, text="Plasma Age (.age)") + + def register(): bpy.types.INFO_MT_file_export.append(menu_cb) diff --git a/korman/operators/op_world.py b/korman/operators/op_world.py index f8052f6..93b79d2 100644 --- a/korman/operators/op_world.py +++ b/korman/operators/op_world.py @@ -15,11 +15,13 @@ import bpy + class AgeOperator: @classmethod def poll(cls, context): return context.scene.render.engine == "PLASMA_GAME" + class PageAddOperator(AgeOperator, bpy.types.Operator): bl_idname = "world.plasma_page_add" bl_label = "Add Page" diff --git a/korman/properties/__init__.py b/korman/properties/__init__.py index 6164589..85ef927 100644 --- a/korman/properties/__init__.py +++ b/korman/properties/__init__.py @@ -18,6 +18,7 @@ import bpy from .prop_object import * from .prop_world import * + def register(): bpy.types.Object.plasma_object = PointerProperty(type=PlasmaObject) bpy.types.World.plasma_age = PointerProperty(type=PlasmaAge) diff --git a/korman/properties/prop_object.py b/korman/properties/prop_object.py index aa31d86..4abaa92 100644 --- a/korman/properties/prop_object.py +++ b/korman/properties/prop_object.py @@ -17,6 +17,7 @@ import bpy from bpy.props import * from PyHSPlasma import * + class PlasmaObject(bpy.types.PropertyGroup): def _enabled(self, context): # This makes me sad diff --git a/korman/properties/prop_world.py b/korman/properties/prop_world.py index baf4785..02bcc78 100644 --- a/korman/properties/prop_world.py +++ b/korman/properties/prop_world.py @@ -17,6 +17,7 @@ import bpy from bpy.props import * from PyHSPlasma import * + class PlasmaFni(bpy.types.PropertyGroup): bl_idname = "world.plasma_fni" @@ -29,10 +30,10 @@ class PlasmaFni(bpy.types.PropertyGroup): ("linear", "Linear", "Linear Fog"), ("exp2", "Exponential", "Exponential Fog"), ("none", "None", "Use fog from the previous age") - ]) + ]) fog_start = FloatProperty(name="Start", description="", - default= -1500.0) + default=-1500.0) fog_end = FloatProperty(name="End", description="", default=20000.0) @@ -49,6 +50,7 @@ class PlasmaFni(bpy.types.PropertyGroup): soft_min=100, min=1) + class PlasmaPage(bpy.types.PropertyGroup): def _check_suffix(self, context): """Verifies that a suffix change does not conflict""" @@ -95,8 +97,8 @@ class PlasmaPage(bpy.types.PropertyGroup): update=_rename_page) seq_suffix = IntProperty(name="ID", description="A numerical ID for this page", - soft_min=0, # Negatives indicate global--advanced users only - default=0, # The add operator will autogen a default + soft_min=0, # Negatives indicate global--advanced users only + default=0, # The add operator will autogen a default update=_check_suffix) auto_load = BoolProperty(name="Auto Load", description="Load this page on link-in", @@ -137,7 +139,7 @@ class PlasmaAge(bpy.types.PropertyGroup): min=0) seq_prefix = IntProperty(name="Sequence Prefix", description="A unique numerical ID for this age", - soft_min=0, # Negative indicates global--advanced users only + soft_min=0, # Negative indicates global--advanced users only default=100) pages = CollectionProperty(name="Pages", description="Registry pages for this age", diff --git a/korman/render.py b/korman/render.py index 5cf02a3..bb3ea6a 100644 --- a/korman/render.py +++ b/korman/render.py @@ -15,6 +15,7 @@ import bpy + class PlasmaRenderEngine(bpy.types.RenderEngine): bl_idname = "PLASMA_GAME" @@ -30,6 +31,7 @@ properties_material.MATERIAL_PT_options.COMPAT_ENGINES.add("PLASMA_GAME") properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.add("PLASMA_GAME") del properties_material + @classmethod def _new_poll(cls, context): """Nifty replacement for naughty built-in Blender poll()s""" @@ -38,6 +40,8 @@ def _new_poll(cls, context): else: # Dear god you better save the old poll... return cls._old_poll(cls, context) + + def _swap_poll(cls): cls._old_poll = cls.poll cls.poll = _new_poll diff --git a/korman/ui/ui_object.py b/korman/ui/ui_object.py index 334a38e..35fd1c2 100644 --- a/korman/ui/ui_object.py +++ b/korman/ui/ui_object.py @@ -15,6 +15,7 @@ import bpy + class ObjectButtonsPanel: bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" diff --git a/korman/ui/ui_world.py b/korman/ui/ui_world.py index af4e9c8..7428120 100644 --- a/korman/ui/ui_world.py +++ b/korman/ui/ui_world.py @@ -15,6 +15,7 @@ import bpy + class AgeButtonsPanel: bl_space_type = "PROPERTIES" bl_region_type = "WINDOW"