Browse Source

Add the ability to export to tracked games

pull/92/head
Adam Johnson 7 years ago
parent
commit
bbb02094a1
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 5
      korman/operators/op_export.py
  2. 4
      korman/properties/prop_world.py
  3. 23
      korman/ui/ui_world.py

5
korman/operators/op_export.py

@ -83,8 +83,7 @@ class ExportOperator(bpy.types.Operator):
@classmethod
def poll(cls, context):
if context.object is not None:
return context.scene.render.engine == "PLASMA_GAME"
return context.scene.render.engine == "PLASMA_GAME"
def execute(self, context):
# Before we begin, do some basic sanity checking...
@ -132,7 +131,7 @@ class ExportOperator(bpy.types.Operator):
if not self.filepath:
blend_filepath = context.blend_data.filepath
if not blend_filepath:
blend_filepath = "Korman"
blend_filepath = context.scene.world.plasma_age.age_name
self.filepath = str(Path(blend_filepath).with_suffix(".age"))
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}

4
korman/properties/prop_world.py

@ -191,6 +191,10 @@ class PlasmaAge(bpy.types.PropertyGroup):
use_texture_page = BoolProperty(name="Use Textures Page",
description="Exports all textures to a dedicated Textures page",
default=True)
age_name = StringProperty(name="Age Name",
description="Name of the Age to be used for data files",
default="Korman Age",
options=set())
# Implementation details
active_page_index = IntProperty(name="Active Page Index")

23
korman/ui/ui_world.py

@ -14,6 +14,9 @@
# along with Korman. If not, see <http://www.gnu.org/licenses/>.
import bpy
from pathlib import Path
from ..korlib import ConsoleToggler
class AgeButtonsPanel:
@ -32,6 +35,7 @@ class PlasmaGamePanel(AgeButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
games = context.world.plasma_games
age = context.world.plasma_age
row = layout.row()
row.template_list("PlasmaGameList", "games", games, "games", games,
@ -56,6 +60,9 @@ class PlasmaGamePanel(AgeButtonsPanel, bpy.types.Panel):
op = row.operator("world.plasma_game_add", icon="FILE_FOLDER", text="Change Path")
op.filepath = active_game.path
op.game_index = active_game_index
row.operator_context = "EXEC_DEFAULT"
op = row.operator("export.plasma_age", icon="EXPORT")
op.filepath = str((Path(active_game.path) / "dat" / age.age_name).with_suffix(".age"))
class PlasmaGameList(bpy.types.UIList):
@ -114,10 +121,26 @@ class PlasmaAgePanel(AgeButtonsPanel, bpy.types.Panel):
col = split.column()
col.label("Age Settings:")
col.prop(age, "seq_prefix", text="ID")
col.prop(age, "age_name", text="")
layout.separator()
split = layout.split()
col = split.column()
col.label("Export Settings:")
col.prop(age, "bake_lighting")
cons_ui = col.column()
cons_ui.enabled = ConsoleToggler.is_platform_supported()
cons_ui.prop(age, "verbose")
cons_ui.prop(age, "show_console")
col = split.column()
col.label("Plasma Settings:")
col.prop(age, "age_sdl")
col.prop(age, "use_texture_page")
class PlasmaEnvironmentPanel(AgeButtonsPanel, bpy.types.Panel):
bl_label = "Plasma Environment"

Loading…
Cancel
Save