mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
Add a wadpath scene property and load the wad files.
This commit is contained in:
parent
95e2a5b21a
commit
b29f24e6d3
2 changed files with 21 additions and 0 deletions
|
@ -80,6 +80,10 @@ def ec_script_update(self, context):
|
|||
self.entity_classes.from_plist(bpy.data.texts[self.script].as_string())
|
||||
|
||||
class QFEntityClasses(bpy.types.PropertyGroup):
|
||||
wadpath = StringProperty(
|
||||
name="wadpath",
|
||||
description="Path to search for wad files",
|
||||
subtype='DIR_PATH')
|
||||
dirpath = StringProperty(
|
||||
name="dirpath",
|
||||
description="Path to qc source tree",
|
||||
|
@ -104,6 +108,7 @@ class QFECPanel(bpy.types.Panel):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
layout.prop(scene.qfmap, "wadpath")
|
||||
layout.prop(scene.qfmap, "dirpath")
|
||||
layout.prop(scene.qfmap, "script")
|
||||
|
||||
|
|
|
@ -19,11 +19,14 @@
|
|||
|
||||
# <pep8 compliant>
|
||||
|
||||
import os
|
||||
|
||||
import bpy
|
||||
from bpy_extras.object_utils import object_data_add
|
||||
from mathutils import Vector,Matrix
|
||||
|
||||
from .map import parse_map, MapError
|
||||
from .wad import WadFile
|
||||
|
||||
def parse_vector(vstr):
|
||||
v = vstr.split()
|
||||
|
@ -129,6 +132,19 @@ def import_map(operator, context, filepath):
|
|||
raise
|
||||
operator.report({'ERROR'}, repr(err))
|
||||
return {'CANCELLED'}
|
||||
wads=[]
|
||||
if entities:
|
||||
if "_wad" in entities[0].d:
|
||||
wads = entities[0].d["_wad"].split(";")
|
||||
elif "wad" in entities[0].d:
|
||||
wads = entities[0].d["wad"].split(";")
|
||||
wadpath = bpy.context.scene.qfmap.wadpath
|
||||
for i in range(len(wads)):
|
||||
try:
|
||||
wads[i] = WadFile.load(os.path.join(wadpath, wads[i]))
|
||||
except IOError:
|
||||
wads[i] = WadFile.load(os.path.join(wadpath,
|
||||
os.path.basename(wads[i])))
|
||||
for ent in entities:
|
||||
process_entity(ent)
|
||||
bpy.context.user_preferences.edit.use_global_undo = True
|
||||
|
|
Loading…
Reference in a new issue