nonlocal stuff again
[carveJwlIkooP6JGAAIwe30JlM.git] / blender_export.py
index eed99af0d9293536fa9e43335a686fe090564069..c8639711a06a352c4a852945ea929c22e693aecd 100644 (file)
@@ -1290,13 +1290,21 @@ def sr_compile( collection ):
          #}
          elif ent_type == 'ent_gate': #{
             gate = ent_gate()
-            gate.type = 0
             obj_data = obj.SR_data.ent_gate[0]
             mesh_data = obj.data.SR_data.ent_gate[0]
-            if obj_data.target:#{
-               gate.target = sr_compile.entity_ids[obj_data.target.name]
-               gate.type = 1
+
+            if obj_data.tipo == 'default':#{
+               if obj_data.target:#{
+                  gate.target = sr_compile.entity_ids[obj_data.target.name]
+                  gate.type = 1
+               #}
+            #}
+            elif obj_data.tipo == 'nonlocal':#{
+               gate.target = sr_compile_string(obj_data.key)
+               gate.type = 2
             #}
+            else: gate.type = 0
+            
             gate.dimensions[0] = mesh_data.dimensions[0]
             gate.dimensions[1] = mesh_data.dimensions[1]
             gate.dimensions[2] = mesh_data.dimensions[2]
@@ -1926,6 +1934,20 @@ class SR_OBJECT_ENT_GATE(bpy.types.PropertyGroup):
    target: bpy.props.PointerProperty( \
                type=bpy.types.Object, name="destination", \
                poll=lambda self,obj: sr_filter_ent_type(obj,['ent_gate']))
+
+   key: bpy.props.StringProperty()
+   tipo: bpy.props.EnumProperty(items=(('default', 'Default', ""),
+                                       ('nonlocal', 'Non-Local', ""),))
+
+   @staticmethod
+   def sr_inspector( layout, data ):
+   #{
+      box = layout.box()
+      box.prop( data[0], 'tipo', text="subtype" )
+
+      if   data[0].tipo == 'default':  box.prop( data[0], 'target' )
+      elif data[0].tipo == 'nonlocal': box.prop( data[0], 'key' )
+   #}
 #}
 
 class SR_MESH_ENT_GATE(bpy.types.PropertyGroup):