Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################
- ## Portal plane
- ###############################
- def GetGroupObjectsReferences(self, context):
- groups = []
- groups.append(('0', "None", "")) # setting a default entry as a first element of our enum
- for obj in bpy.context.scene.objects:
- if obj.WowWMOGroup.Enabled:
- groups.append((obj.name, obj.name, ""))
- return groups
- '''
- def UpdateFirstGroupObjectReference(self, context):
- if context.object.WowPortalPlane.First == context.object.WowPortalPlane.Second and context.object.WowPortalPlane.First != '0':
- context.object.WowPortalPlane.Second = '0'
- def UpdateSecondGroupObjectReference(self, context):
- if context.object.WowPortalPlane.Second == context.object.WowPortalPlane.First and context.object.WowPortalPlane.Second != '0':
- context.object.WowPortalPlane.First = '0'
- '''
- class WowPortalPlanePanel(bpy.types.Panel):
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
- bl_context = "object"
- bl_label = "Wow Portal Plane"
- bl_options = {'DEFAULT_CLOSED'}
- def draw_header(self, context):
- layout = self.layout
- self.layout.prop(context.object.WowPortalPlane, "Enabled")
- def draw(self, context):
- layout = self.layout
- row = layout.row()
- layout.enabled = context.object.WowPortalPlane.Enabled
- self.layout.prop(context.object.WowPortalPlane, "First")
- self.layout.prop(context.object.WowPortalPlane, "Second")
- @classmethod
- def poll(cls, context):
- return (context.object is not None and context.object.data is not None and isinstance(context.object.data,bpy.types.Mesh))
- class WowPortalPlanePropertyGroup(bpy.types.PropertyGroup):
- Enabled = bpy.props.BoolProperty(name="", description="Enable wow WMO group properties")
- First = bpy.props.EnumProperty(items=GetGroupObjectsReferences, name="First group", description="First group")
- Second = bpy.props.EnumProperty(items=GetGroupObjectsReferences, name="Second group", description="Second group")
- PortalID = bpy.props.IntProperty(name="Portal's ID", description="Portal ID")
- def RegisterWowPortalPlaneProperties():
- bpy.types.Object.WowPortalPlane = bpy.props.PointerProperty(type=WowPortalPlanePropertyGroup)
- def UnregisterWowPortalPlaneProperties():
- bpy.types.Object.WowPortalPlane = None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement