Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. ###############################
  2. ## Portal plane
  3. ###############################
  4.  
  5. def GetGroupObjectsReferences(self, context):
  6.  
  7. groups = []
  8. groups.append(('0', "None", "")) # setting a default entry as a first element of our enum
  9.  
  10. for obj in bpy.context.scene.objects:
  11. if obj.WowWMOGroup.Enabled:
  12. groups.append((obj.name, obj.name, ""))
  13.  
  14. return groups
  15.  
  16. '''
  17. def UpdateFirstGroupObjectReference(self, context):
  18.  
  19. if context.object.WowPortalPlane.First == context.object.WowPortalPlane.Second and context.object.WowPortalPlane.First != '0':
  20. context.object.WowPortalPlane.Second = '0'
  21.  
  22. def UpdateSecondGroupObjectReference(self, context):
  23.  
  24. if context.object.WowPortalPlane.Second == context.object.WowPortalPlane.First and context.object.WowPortalPlane.Second != '0':
  25. context.object.WowPortalPlane.First = '0'
  26. '''
  27.  
  28.  
  29. class WowPortalPlanePanel(bpy.types.Panel):
  30. bl_space_type = "PROPERTIES"
  31. bl_region_type = "WINDOW"
  32. bl_context = "object"
  33. bl_label = "Wow Portal Plane"
  34. bl_options = {'DEFAULT_CLOSED'}
  35.  
  36. def draw_header(self, context):
  37. layout = self.layout
  38. self.layout.prop(context.object.WowPortalPlane, "Enabled")
  39.  
  40. def draw(self, context):
  41. layout = self.layout
  42. row = layout.row()
  43. layout.enabled = context.object.WowPortalPlane.Enabled
  44. self.layout.prop(context.object.WowPortalPlane, "First")
  45. self.layout.prop(context.object.WowPortalPlane, "Second")
  46.  
  47. @classmethod
  48. def poll(cls, context):
  49. return (context.object is not None and context.object.data is not None and isinstance(context.object.data,bpy.types.Mesh))
  50.  
  51. class WowPortalPlanePropertyGroup(bpy.types.PropertyGroup):
  52. Enabled = bpy.props.BoolProperty(name="", description="Enable wow WMO group properties")
  53. First = bpy.props.EnumProperty(items=GetGroupObjectsReferences, name="First group", description="First group")
  54. Second = bpy.props.EnumProperty(items=GetGroupObjectsReferences, name="Second group", description="Second group")
  55. PortalID = bpy.props.IntProperty(name="Portal's ID", description="Portal ID")
  56.  
  57. def RegisterWowPortalPlaneProperties():
  58. bpy.types.Object.WowPortalPlane = bpy.props.PointerProperty(type=WowPortalPlanePropertyGroup)
  59.  
  60. def UnregisterWowPortalPlaneProperties():
  61. bpy.types.Object.WowPortalPlane = None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement