Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-07-22 10:42:47 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-22 10:42:47 +0400
commit9420b9504cb305f7e71155f9d1d82d1609b932cc (patch)
tree94d2c5d5b9ef0df96a9ae87f947756ec7acbe5de
parent4746348799f063bf35b46e71831a35ad6b0d88a6 (diff)
fix [#27949] r2121 Quake MAP exports incomplete brush data from 2.58.1
add default texture option back also added back options - scale - snap to whole value - face thickness - default brush
-rw-r--r--io_scene_map/__init__.py31
-rw-r--r--io_scene_map/export_map.py30
2 files changed, 53 insertions, 8 deletions
diff --git a/io_scene_map/__init__.py b/io_scene_map/__init__.py
index a9610ef5..cc265410 100644
--- a/io_scene_map/__init__.py
+++ b/io_scene_map/__init__.py
@@ -40,7 +40,7 @@ if "bpy" in locals():
import bpy
-from bpy.props import StringProperty
+from bpy.props import StringProperty, FloatProperty, BoolProperty
from bpy_extras.io_utils import ExportHelper
@@ -53,6 +53,35 @@ class ExportMAP(bpy.types.Operator, ExportHelper):
filename_ext = ".map"
filter_glob = StringProperty(default="*.map", options={'HIDDEN'})
+ face_thickness = FloatProperty(
+ name="Face Thickness",
+ description=("Thickness given to geometry which can't be "
+ "converted into a brush"),
+ min=0.0001, max=10.0,
+ default=0.1,
+ )
+ global_scale = FloatProperty(
+ name="Scale",
+ description="Scale everything by this value",
+ min=0.01, max=1000.0,
+ default=100.0,
+ )
+ grid_snap = BoolProperty(
+ name="Grid Snap",
+ description="Round to whole numbers",
+ default=False,
+ )
+ texture_null = StringProperty(
+ name="Tex Null",
+ description="Texture used when none is assigned",
+ default="NULL",
+ )
+ texture_opts = StringProperty(
+ name="Tex Opts",
+ description="Brush texture options",
+ default='0 0 0 1 1 0 0 0',
+ )
+
'''
def check(self, context):
return axis_conversion_ensure(self, "axis_forward", "axis_up")
diff --git a/io_scene_map/export_map.py b/io_scene_map/export_map.py
index 8feb2cc8..b8f91ed4 100644
--- a/io_scene_map/export_map.py
+++ b/io_scene_map/export_map.py
@@ -26,9 +26,8 @@ PREF_SCALE = 100
PREF_FACE_THICK = 0.1
PREF_GRID_SNAP = False
# Quake 1/2?
-# PREF_DEF_TEX_OPTS = Draw.Create(' 0 0 0 1 1\n') # not user settable yet
# Quake 3+?
-PREF_DEF_TEX_OPTS = ' 0 0 0 1 1 0 0 0\n' # not user settable yet
+PREF_DEF_TEX_OPTS = '0 0 0 1 1 0 0 0' # not user settable yet
PREF_NULL_TEX = 'NULL' # not user settable yet
PREF_INVIS_TEX = 'common/caulk'
@@ -80,7 +79,7 @@ def write_cube2brush(file, faces):
file.write(PREF_NULL_TEX)
# Texture stuff ignored for now
- file.write(PREF_DEF_TEX_OPTS)
+ file.write(" %s\n" % PREF_DEF_TEX_OPTS)
file.write('}\n')
@@ -133,7 +132,7 @@ def write_face2brush(file, face):
file.write(format_vec % co)
file.write(image_text)
# Texture stuff ignored for now
- file.write(PREF_DEF_TEX_OPTS)
+ file.write(" %s\n" % PREF_DEF_TEX_OPTS)
for co in new_vco[:3]:
file.write(format_vec % co)
@@ -143,7 +142,7 @@ def write_face2brush(file, face):
file.write(PREF_INVIS_TEX)
# Texture stuff ignored for now
- file.write(PREF_DEF_TEX_OPTS)
+ file.write(" %s\n" % PREF_DEF_TEX_OPTS)
# sides.
if len(orig_vco) == 3: # Tri, it seemms tri brushes are supported.
@@ -155,7 +154,7 @@ def write_face2brush(file, face):
for co in orig_vco[i1], orig_vco[i2], new_vco[i2]:
file.write(format_vec % co)
file.write(PREF_INVIS_TEX)
- file.write(PREF_DEF_TEX_OPTS)
+ file.write(" %s\n" % PREF_DEF_TEX_OPTS)
file.write('}\n')
@@ -331,7 +330,7 @@ def export_map(context, filepath):
dummy_mesh.transform(ob.matrix_world * SCALE_MAT)
if PREF_GRID_SNAP:
- for v in dummy_mesh.verts:
+ for v in dummy_mesh.vertices:
v.co[:] = v.co.to_tuple(0)
# High quality normals
@@ -464,8 +463,25 @@ NULL
def save(operator,
context,
filepath=None,
+ global_scale=100.0,
+ face_thickness=0.1,
+ texture_null="NULL",
+ texture_opts='0 0 0 1 1 0 0 0',
+ grid_snap=False,
):
+ global PREF_SCALE
+ global PREF_FACE_THICK
+ global PREF_NULL_TEX
+ global PREF_DEF_TEX_OPTS
+ global PREF_GRID_SNAP
+
+ PREF_SCALE = global_scale
+ PREF_FACE_THICK = face_thickness
+ PREF_NULL_TEX = texture_null
+ PREF_DEF_TEX_OPTS = texture_opts
+ PREF_GRID_SNAP = grid_snap
+
export_map(context, filepath)
return {'FINISHED'}