Ejemplo n.º 1
0
	def draw(self, context):
		layout = self.layout
		globalSettings = bpy.context.scene.ogre_mesh_exporter

		# ####################################################
		# display preference view.
		# ####################################################
		if (MainExporterPanel.sViewState == MainExporterPanel.VS_PREFERENCE):
			col = layout.column(True)
			col.label("Global Static Config (shared across blend files):")
			staticConfigBox = col.box()
			col = staticConfigBox.column()
			col.prop(globalSettings, "ogreXMLConverterPath")
			col.prop(globalSettings, "ogreXMLConverterAdditionalArg")
			row = col.row()
			row.split()
			row.operator("ogre3d.preferences_apply_static_config", icon = 'LIBRARY_DATA_DIRECT')

			xmlConverterOptionsBox = layout.column(True)
			xmlConverterOptionsBox.label("Global XML Converter Options:")

			disableConverterOptions = not globalSettings.useXMLConverterOptions
			row = xmlConverterOptionsBox.row(True)
			row.prop(globalSettings, "useXMLConverterOptions", "", 'MODIFIER', toggle = True)
			row = row.row(True)
			if (disableConverterOptions): row.enabled = False
			row.prop(globalSettings, "extremityPoints")
			row.prop(globalSettings, "edgeLists", toggle = True)
			row.prop(globalSettings, "tangent", toggle = True)
			row = xmlConverterOptionsBox.row(True)
			if (disableConverterOptions): row.enabled = False
			row.prop(globalSettings, "tangentSemantic", "")
			row.prop(globalSettings, "tangentSize", "")
			row.prop(globalSettings, "splitMirrored", toggle = True)
			row.prop(globalSettings, "splitRotated", toggle = True)
			row = xmlConverterOptionsBox.row(True)
			if (disableConverterOptions): row.enabled = False
			row.prop(globalSettings, "reorganiseVertBuff", toggle = True)
			row.prop(globalSettings, "optimiseAnimation", toggle = True)

			row = layout.row()
			row.scale_y = 1.5
			row.operator("ogre3d.preferences_back", icon = 'BACK')
			return

		# ####################################################
		# display log view.
		# ####################################################
		elif (MainExporterPanel.sViewState == MainExporterPanel.VS_LOG):
			LogManager.drawLog(layout)
			return

		# ####################################################
		# display main view.
		# ####################################################

		# display selection list.
		col = layout.column()
		col.label("Selected:")
		selectedObjectList = globalSettings.selectedObjectList
		col.template_list(selectedObjectList, "collection", selectedObjectList, "collectionIndex")

		# ####################################################
		# Material settings
		disableMaterialSettings = not globalSettings.exportMaterials
		materialExportBox = layout.column(True)
		materialExportBox.label("Material Settings:")
		row = materialExportBox.row(True)
		row.prop(globalSettings, "exportMaterials", "", 'MATERIAL', toggle = True)
		row = row.row(True)
		if (disableMaterialSettings): row.enabled = False
		row.prop(globalSettings, "materialFile", "")
		row.prop(globalSettings, "copyTextures", "", 'TEXTURE', toggle = True)
		row = materialExportBox.row(True)
		if (disableMaterialSettings): row.enabled = False
		row.prop_enum(globalSettings, "materialExportMode", 'rend')
		row.prop_enum(globalSettings, "materialExportMode", 'game')
		row.prop_enum(globalSettings, "materialExportMode", 'custom')
		row = materialExportBox.row(True)
		if (disableMaterialSettings or globalSettings.materialExportMode != 'custom'): row.enabled = False
		row.prop(globalSettings, "templatePath", "")

		# ####################################################
		# Mesh settings
		disableMeshSettings = not globalSettings.exportMeshes
		meshExportBox = layout.column(True)
		meshExportBox.label("Mesh Settings:")
		row = meshExportBox.row(True)
		row.prop(globalSettings, "exportMeshes", "", 'MESH_MONKEY', toggle = True)
		row = row.row(True)
		if (disableMeshSettings): row.enabled = False
		row.prop(globalSettings, "fixUpAxisToY", icon = 'NONE', toggle = True)
		row.prop(globalSettings, "requireMaterials", icon = 'NONE', toggle = True)
		row.prop(globalSettings, "applyModifiers", icon = 'NONE', toggle = True)
		row = meshExportBox.row(True)
		if (disableMeshSettings): row.enabled = False
		row.prop(globalSettings, "skeletonNameFollowMesh", icon = 'NONE', toggle = True)
		row.prop(globalSettings, "runOgreXMLConverter", icon = 'NONE', toggle = True)

		exportPathValid = os.path.isdir(globalSettings.exportPath)

		exportPathBox = layout.column(True)
		exportPathBox.label("Export Path:")
		exportPathBox.prop(globalSettings, "exportPath", "",
			icon = ('NONE' if (exportPathValid) else 'ERROR'))

		row = layout.row(True)
		subrow = row.row()
		subrow.scale_y = 1.5
		exportRow = subrow.row(True)
		exportRow.scale_y = 1.5
		if (not exportPathValid or len(selectedObjectList.collection) == 0 or \
			(not globalSettings.exportMeshes and not globalSettings.exportMaterials)):
			exportRow.enabled = False
		exportRow.operator("ogre3d.export", icon = 'SCRIPTWIN')
		subrow.operator("ogre3d.preferences", icon = 'SETTINGS')
		subrow.operator("ogre3d.help", icon = 'HELP')
		row = row.row()
		row.scale_y = 1.5
		row.alignment = 'RIGHT'
		row.operator("ogre3d.log", "", icon = 'CONSOLE')
Ejemplo n.º 2
0
    def draw(self, context):
        layout = self.layout
        globalSettings = bpy.context.scene.ogre_mesh_exporter

        # ####################################################
        # display preference view.
        # ####################################################
        if (MainExporterPanel.sViewState == MainExporterPanel.VS_PREFERENCE):
            col = layout.column(True)
            col.label("Global Static Config (shared across blend files):")
            staticConfigBox = col.box()
            col = staticConfigBox.column()
            col.prop(globalSettings, "ogreXMLConverterPath")
            col.prop(globalSettings, "ogreXMLConverterAdditionalArg")
            row = col.row()
            row.split()
            row.operator("ogre3d.preferences_apply_static_config",
                         icon='LIBRARY_DATA_DIRECT')

            xmlConverterOptionsBox = layout.column(True)
            xmlConverterOptionsBox.label("Global XML Converter Options:")

            disableConverterOptions = not globalSettings.useXMLConverterOptions
            row = xmlConverterOptionsBox.row(True)
            row.prop(globalSettings,
                     "useXMLConverterOptions",
                     "",
                     'MODIFIER',
                     toggle=True)
            row = row.row(True)
            if (disableConverterOptions): row.enabled = False
            row.prop(globalSettings, "extremityPoints")
            row.prop(globalSettings, "edgeLists", toggle=True)
            row.prop(globalSettings, "tangent", toggle=True)
            row = xmlConverterOptionsBox.row(True)
            if (disableConverterOptions): row.enabled = False
            row.prop(globalSettings, "tangentSemantic", "")
            row.prop(globalSettings, "tangentSize", "")
            row.prop(globalSettings, "splitMirrored", toggle=True)
            row.prop(globalSettings, "splitRotated", toggle=True)
            row = xmlConverterOptionsBox.row(True)
            if (disableConverterOptions): row.enabled = False
            row.prop(globalSettings, "reorganiseVertBuff", toggle=True)
            row.prop(globalSettings, "optimiseAnimation", toggle=True)

            row = layout.row()
            row.scale_y = 1.5
            row.operator("ogre3d.preferences_back", icon='BACK')
            return

        # ####################################################
        # display log view.
        # ####################################################
        elif (MainExporterPanel.sViewState == MainExporterPanel.VS_LOG):
            LogManager.drawLog(layout)
            return

        # ####################################################
        # display main view.
        # ####################################################

        # display selection list.
        col = layout.column()
        col.label("Selected:")
        selectedObjectList = globalSettings.selectedObjectList
        col.template_list(selectedObjectList, "collection", selectedObjectList,
                          "collectionIndex")

        # ####################################################
        # Material settings
        disableMaterialSettings = not globalSettings.exportMaterials
        materialExportBox = layout.column(True)
        materialExportBox.label("Material Settings:")
        row = materialExportBox.row(True)
        row.prop(globalSettings,
                 "exportMaterials",
                 "",
                 'MATERIAL',
                 toggle=True)
        row = row.row(True)
        if (disableMaterialSettings): row.enabled = False
        row.prop(globalSettings, "materialFile", "")
        row.prop(globalSettings, "copyTextures", "", 'TEXTURE', toggle=True)
        row = materialExportBox.row(True)
        if (disableMaterialSettings): row.enabled = False
        row.prop_enum(globalSettings, "materialExportMode", 'rend')
        row.prop_enum(globalSettings, "materialExportMode", 'game')
        row.prop_enum(globalSettings, "materialExportMode", 'custom')
        row = materialExportBox.row(True)
        if (disableMaterialSettings
                or globalSettings.materialExportMode != 'custom'):
            row.enabled = False
        row.prop(globalSettings, "templatePath", "")

        # ####################################################
        # Mesh settings
        disableMeshSettings = not globalSettings.exportMeshes
        meshExportBox = layout.column(True)
        meshExportBox.label("Mesh Settings:")
        row = meshExportBox.row(True)
        row.prop(globalSettings,
                 "exportMeshes",
                 "",
                 'MESH_MONKEY',
                 toggle=True)
        row = row.row(True)
        if (disableMeshSettings): row.enabled = False
        row.prop(globalSettings, "fixUpAxisToY", icon='NONE', toggle=True)
        row.prop(globalSettings, "requireMaterials", icon='NONE', toggle=True)
        row.prop(globalSettings, "applyModifiers", icon='NONE', toggle=True)
        row = meshExportBox.row(True)
        if (disableMeshSettings): row.enabled = False
        row.prop(globalSettings,
                 "skeletonNameFollowMesh",
                 icon='NONE',
                 toggle=True)
        row.prop(globalSettings,
                 "runOgreXMLConverter",
                 icon='NONE',
                 toggle=True)

        exportPathValid = os.path.isdir(globalSettings.exportPath)

        exportPathBox = layout.column(True)
        exportPathBox.label("Export Path:")
        exportPathBox.prop(globalSettings,
                           "exportPath",
                           "",
                           icon=('NONE' if (exportPathValid) else 'ERROR'))

        row = layout.row(True)
        subrow = row.row()
        subrow.scale_y = 1.5
        exportRow = subrow.row(True)
        exportRow.scale_y = 1.5
        if (not exportPathValid or len(selectedObjectList.collection) == 0 or \
         (not globalSettings.exportMeshes and not globalSettings.exportMaterials)):
            exportRow.enabled = False
        exportRow.operator("ogre3d.export", icon='SCRIPTWIN')
        subrow.operator("ogre3d.preferences", icon='SETTINGS')
        subrow.operator("ogre3d.help", icon='HELP')
        row = row.row()
        row.scale_y = 1.5
        row.alignment = 'RIGHT'
        row.operator("ogre3d.log", "", icon='CONSOLE')