[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4731] contrib/py/scripts/addons/ io_scene_fpx: fixed wrong image name for DEFAULT_LAMP_TEXTURE
Alexander N.
alpha-beta-release at gmx.net
Tue Sep 3 18:29:20 CEST 2013
Revision: 4731
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4731
Author: beta-tester
Date: 2013-09-03 16:29:20 +0000 (Tue, 03 Sep 2013)
Log Message:
-----------
fixed wrong image name for DEFAULT_LAMP_TEXTURE
- fixed wrong image name for DEFAULT_LAMP_TEXTURE,
- added light instead of iso_spheres (dummies).,
- added camera,
- changed slightly texture material
- changed typo
- changed version numbering (i hope that is acceptable now)
Modified Paths:
--------------
contrib/py/scripts/addons/io_scene_fpx/__init__.py
contrib/py/scripts/addons/io_scene_fpx/fpx_import.py
contrib/py/scripts/addons/io_scene_fpx/fpx_spec.py
Modified: contrib/py/scripts/addons/io_scene_fpx/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_scene_fpx/__init__.py 2013-09-03 04:04:33 UTC (rev 4730)
+++ contrib/py/scripts/addons/io_scene_fpx/__init__.py 2013-09-03 16:29:20 UTC (rev 4731)
@@ -34,7 +34,7 @@
'name': "Future Pinball FPx format (.fpm/.fpl/.fpt)",
'description': "Import Future Pinball Model, Library and Table files",
'author': "Alexander Nussbaumer",
- 'version': (0, 0, 0),
+ 'version': (0, 0, 309031),
'blender': (2, 68, 0),
'location': "File > Import",
'warning': "",
@@ -45,6 +45,51 @@
}
+# KNOWN ISSUES & TODOs & MAYBEs (in a random order):
+#
+# - issue: curve bevel sometimes not assigned.
+# close blender and open again, may change the behavior.
+# - issue: material assignment is not consistent.
+# models got multiple materials assigned.
+# models got christal material assigned instead texture.
+# - issue: some images could not be loaded to blender.
+# IMB_ibImageFromMemory: unknown fileformat (e.g.:__grab__fpl__\bulb_trigger_star_v2\Bulb-Trigger-Star-v2.bmp)
+# TGS x% missing?
+#
+# - todo: delete all unused temporary scenes with its content.
+# to shrink file size.
+# - todo: create better light settings.
+# should give nice results for "Blender Render" and "Cycles Render" render engine.
+# - todo: create better material settings.
+# handling texture, color, transparent, christal, light, chrome.
+# - todo: create camera + setup
+# to see the whole table, playfield, backglass.
+# - todo: make all materials and material textures as separate.
+# to bypass cyclic textures at texture baking.
+# - todo: cut holes to playfield and surfaces for mask models.
+# using curves? - by separate model mask and add as curve - multiple curves to one mesh?
+# using boolean? - by separate model mask and for each a boolean modifier?
+# - todo: align models only on .fpt import not as currently on .fpm level.
+# find a way to get a general method, to align model position alignment at .fpt level, not on .fpm level.
+# (more hardcoding?)
+#
+# - maybe: add a pop-up message/dialog to inform the user, that the import process takes its time.
+# progress bar/text - is there something like that available in blender?
+# - maybe: light dome (baking ambient occlusion has some issues)
+# - maybe: import image lists as image sequences (maybe for BGE usage far far later)
+# - maybe: animation got lost by got rid of using dupli-groups
+# copy the animations object-by-object and make them as NLA action strip (maybe for BGE usage far far later)
+# - maybe: import sounds. (maybe for BGE usage far far later)
+# - maybe: import music. (maybe for BGE usage far far later)
+# - maybe: import VisualBasic script and transform to python script. (maybe for BGE usage far far later)
+#
+# - maybe: add possibility to export/write back future pinball model files (.fpm)
+# import/handle/export collision data
+# rewrite/extend cfb_spec.py for write IO
+# rewrite/extend fpx_spec.py for write IO
+# rewrite/extend lzo_spec.py for write IO
+
+
# To support reload properly, try to access a package var,
# if it's there, reload everything
if 'bpy' in locals():
Modified: contrib/py/scripts/addons/io_scene_fpx/fpx_import.py
===================================================================
--- contrib/py/scripts/addons/io_scene_fpx/fpx_import.py 2013-09-03 04:04:33 UTC (rev 4730)
+++ contrib/py/scripts/addons/io_scene_fpx/fpx_import.py 2013-09-03 16:29:20 UTC (rev 4731)
@@ -125,8 +125,9 @@
FORMAT_ARMATURE = "{}.a"
FORMAT_ARMATURE_OBJECT = "{}.ao"
FORMAT_ARMATURE_NLA = "{}.an"
+FORMAT_LAMP = "{}.l"
+FORMAT_LAMP_OBJECT = "{}.lo"
-#FORMAT_RESOURCE = "{}\\{}"
FORMAT_RESOURCE = "{{{}}}.{}"
PREFIX_LOCAL = "1"
@@ -141,9 +142,8 @@
FORMAT_MODEL_CAP2 = "{}.cap2"
FORMAT_MODEL_RING = "{}.ring{:02d}"
-#DEFAULT_LAMP_TEXTURE = "{1}.rsrc_bmp_254.i"
DEFAULT_LAMP_TEXTURE = "rsrc_bmp_254"
-DEFAULT_LAMP_TEXTURE = "rsrc_bmp_290"
+DEFAULT_SLINGHAMMER_TEXTURE = "rsrc_bmp_290"
TRANSLITE_OBJECT = 2
###############################################################################
@@ -209,7 +209,8 @@
fpx_reader = None
self.__context = blender_context
- self.__blend_data = blender_context.blend_data
+ self.__data = blender_context.blend_data
+ self.__scene = blender_context.scene
self.__table_width = 0.0
self.__table_length = 0.0
@@ -294,7 +295,8 @@
finally:
self.__context = None
- self.__blend_data = None
+ self.__data = None
+ self.__scene = None
t3 = time()
if self.verbose in FpxUI.VERBOSE_NORMAL:
@@ -421,7 +423,9 @@
fpx_reader = None
self.__context = blender_context
- self.__blend_data = blender_context.blend_data
+ self.__data = blender_context.blend_data
+ self.__scene = blender_context.scene
+
active_scene = self.__context.screen.scene
try:
@@ -484,7 +488,7 @@
elif type == Fpl_Library_Type.TYPE_GRAPHIC:
#print("#DEBUG", type, key_name)
- blend_image = self.__blend_data.images.load(item_path)
+ blend_image = self.__data.images.load(item_path)
blend_image.name = FpxUtilities.toGoodName(FORMAT_RESOURCE.format(file_name, FORMAT_IMAGE.format(key_name)))
blend_image.pack()
blend_image.use_fake_user = True
@@ -555,7 +559,8 @@
finally:
self.__context.screen.scene = active_scene
self.__context = None
- self.__blend_data = None
+ self.__data = None
+ self.__scene = None
t3 = time()
if self.verbose in FpxUI.VERBOSE_NORMAL:
@@ -637,7 +642,8 @@
fpx_reader = None
self.__context = blender_context
- self.__blend_data = blender_context.blend_data
+ self.__data = blender_context.blend_data
+ self.__scene = blender_context.scene
try:
try:
@@ -659,7 +665,7 @@
dst_path, dst_sub_path_names = fpx_reader.grab_content(temp_name)
# setup current Scene to default units
- ##FpxUtilities.set_scene_to_default(self.__context.scene)
+ ##FpxUtilities.set_scene_to_default(self.__scene)
self.folder_name, file_name = path.split(filepath)
@@ -800,13 +806,13 @@
blender_position = self.geometry_correction((fpx_position_xy[0], fpx_position_xy[1], fpx_position_z))
- blender_empty_object = self.__blend_data.objects.new(FORMAT_EMPTY_OBJECT.format(fpx_item_name), None)
+ blender_empty_object = self.__data.objects.new(FORMAT_EMPTY_OBJECT.format(fpx_item_name), None)
blender_empty_object.location = blender_position
blender_empty_object.rotation_mode = 'XZY'
blender_empty_object.rotation_euler = blender_rotation
blender_empty_object.empty_draw_type = 'ARROWS'
blender_empty_object.empty_draw_size = 10.0
- self.__context.scene.objects.link(blender_empty_object)
+ self.__scene.objects.link(blender_empty_object)
blender_empty_object.layers = layers
blender_empty_object.fpt.name = fpx_item_name
@@ -867,9 +873,10 @@
## #DEBUG : light dummies
if fpx_id in FptElementType.SET_LIGHT_OBJECTS: # and not blender_empty_object.children:
- if ops.mesh.primitive_ico_sphere_add.poll():
- ops.mesh.primitive_ico_sphere_add(subdivisions=2, size=self.debug_lightball_size, location=blender_empty_object.location + Vector((0.0, 0.0, self.debug_lightball_height)), layers=FptImporter.LAYERS_LIGHT_SPHERE)
- self.append_light_material(self.__context.active_object)
+ #if ops.mesh.primitive_ico_sphere_add.poll():
+ # ops.mesh.primitive_ico_sphere_add(subdivisions=2, size=self.debug_lightball_size, location=blender_empty_object.location + Vector((0.0, 0.0, self.debug_lightball_height)), layers=FptImporter.LAYERS_LIGHT_SPHERE)
+ # self.append_light_material(self.__context.active_object)
+ self.add_lamp(fpx_item_name, blender_empty_object.location + Vector((0.0, 0.0, self.debug_lightball_height)), layers=FptImporter.LAYERS_LIGHT_SPHERE)
# cleanup
if not self.keep_temp:
@@ -906,8 +913,11 @@
except:
pass
+ self.add_camera(fpx_reader.Table_Data)
+
# setup all current 3d Views of the current scene to metric units
FpxUtilities.set_scene_to_metric(self.__context)
+ FpxUtilities.select_all(False)
if self.verbose in FpxUI.VERBOSE_NORMAL:
print()
@@ -931,7 +941,8 @@
finally:
self.__context = None
- self.__blend_data = None
+ self.__data = None
+ self.__scene = None
t3 = time()
if self.verbose in FpxUI.VERBOSE_NORMAL:
@@ -940,7 +951,50 @@
return {"FINISHED"}
- def append_texture_material(self, blender_object, fpx_image_name, light_on=True, uv_layer=None):
+ def add_camera(self, fpx_table_data):
+ name = "Camera.table"
+ camera = self.__data.cameras.new(name)
+ obj = self.__data.objects.new(name, camera)
+ self.__scene.objects.link(obj)
+ width = fpx_table_data.get_value("width", default=0.0)
+ obj.location = (width / 2.0, -1600.0, 550.0)
+ obj.rotation_euler = (radians(63.0), 0.0, 0.0)
+ obj.select = True
+ camera.clip_end = 15000.0
+ self.__scene.camera = obj
+ self.__scene.update()
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list