예제 #1
0
def terain_clamp_ui():

    # Only to center the UI
    x, y = GLOBALS['MOUSE']
    x -= 40
    y -= 70

    Draw.Label('Drop Axis', x - 70, y + 120, 60, 20)
    Draw.BeginAlign()
    GLOBALS['DROP_AXIS'][0] = Draw.Toggle('Z', EVENT_REDRAW, x + 20, y + 120,
                                          30, 20, GLOBALS['DROP_AXIS'][0].val,
                                          'Drop down on the global Z axis',
                                          do_axis_z)
    GLOBALS['DROP_AXIS'][1] = Draw.Toggle('View Z', EVENT_REDRAW, x + 50,
                                          y + 120, 70, 20,
                                          GLOBALS['DROP_AXIS'][1].val,
                                          'Drop allong the view vector',
                                          do_axis_view)
    Draw.EndAlign()

    # Source
    Draw.Label('Drop on to...', x - 70, y + 90, 120, 20)
    Draw.BeginAlign()
    GLOBALS['GROUND_SOURCE'][0] = Draw.Toggle('Active Object', EVENT_REDRAW,
                                              x - 70, y + 70, 110, 20,
                                              GLOBALS['GROUND_SOURCE'][0].val,
                                              '', do_ground_source_act)
    GLOBALS['GROUND_SOURCE'][1] = Draw.Toggle('Group', EVENT_REDRAW, x + 40,
                                              y + 70, 80, 20,
                                              GLOBALS['GROUND_SOURCE'][1].val,
                                              '', do_ground_source_group)
    if GLOBALS['GROUND_SOURCE'][1].val:
        GLOBALS['GROUND_GROUP_NAME'] = Draw.String(
            'GR:', EVENT_REDRAW + 1001, x - 70, y + 50, 190, 20,
            GLOBALS['GROUND_GROUP_NAME'].val, 21, '', do_ground_group_name)
    Draw.EndAlign()

    GLOBALS['DROP_OVERLAP_CHECK'] = Draw.Toggle(
        'Overlapping Terrain', EVENT_NONE, x - 70, y + 20, 190, 20,
        GLOBALS['DROP_OVERLAP_CHECK'].val,
        "Check all terrain triangles and use the top most (slow)")

    Draw.BeginAlign()
    GLOBALS['DROP_ORIENT'] = Draw.Toggle('Orient Normal', EVENT_REDRAW, x - 70,
                                         y - 10, 110, 20,
                                         GLOBALS['DROP_ORIENT'].val,
                                         "Rotate objects to the face normal",
                                         do_dummy)
    if GLOBALS['DROP_ORIENT'].val:
        GLOBALS['DROP_ORIENT_VALUE'] = Draw.Number(
            '', EVENT_NONE, x + 40, y - 10, 80, 20,
            GLOBALS['DROP_ORIENT_VALUE'].val, 0.0, 100.0,
            "Percentage to orient 0.0 - 100.0")
    Draw.EndAlign()

    Draw.PushButton('Drop Objects', EVENT_EXIT, x + 20, y - 40, 100, 20,
                    'Drop the selected objects', terrain_clamp)

    # So moving the mouse outside the popup exits the while loop
    GLOBALS['EVENT'] = EVENT_EXIT
예제 #2
0
		def obj_ui():
			ui_x, ui_y = GLOBALS['MOUSE']
			
			# Center based on overall pup size
			ui_x -= 165
			ui_y -= 90
			
			global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, POLYGROUPS, KEEP_VERT_ORDER, ROTATE_X90
			
			Draw.Label('Import...', ui_x+9, ui_y+159, 220, 21)
			Draw.BeginAlign()
			CREATE_SMOOTH_GROUPS = Draw.Toggle('Smooth Groups', EVENT_NONE, ui_x+9, ui_y+139, 110, 20, CREATE_SMOOTH_GROUPS.val, 'Surround smooth groups by sharp edges')
			CREATE_FGONS = Draw.Toggle('NGons as FGons', EVENT_NONE, ui_x+119, ui_y+139, 110, 20, CREATE_FGONS.val, 'Import faces with more then 4 verts as fgons')
			CREATE_EDGES = Draw.Toggle('Lines as Edges', EVENT_NONE, ui_x+229, ui_y+139, 110, 20, CREATE_EDGES.val, 'Import lines and faces with 2 verts as edges')
			Draw.EndAlign()
			
			Draw.Label('Separate objects by OBJ...', ui_x+9, ui_y+110, 220, 20)
			Draw.BeginAlign()
			SPLIT_OBJECTS = Draw.Toggle('Object', EVENT_REDRAW, ui_x+9, ui_y+89, 55, 21, SPLIT_OBJECTS.val, 'Import OBJ Objects into Blender Objects', do_split)
			SPLIT_GROUPS = Draw.Toggle('Group', EVENT_REDRAW, ui_x+64, ui_y+89, 55, 21, SPLIT_GROUPS.val, 'Import OBJ Groups into Blender Objects', do_split)
			SPLIT_MATERIALS = Draw.Toggle('Material', EVENT_REDRAW, ui_x+119, ui_y+89, 60, 21, SPLIT_MATERIALS.val, 'Import each material into a seperate mesh (Avoids > 16 per mesh error)', do_split)
			Draw.EndAlign()
			
			# Only used for user feedback
			KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+184, ui_y+89, 113, 21, KEEP_VERT_ORDER.val, 'Keep vert and face order, disables split options, enable for morph targets', do_vertorder)
			
			ROTATE_X90 = Draw.Toggle('-X90', EVENT_REDRAW, ui_x+302, ui_y+89, 38, 21, ROTATE_X90.val, 'Rotate X 90.')
			
			Draw.Label('Options...', ui_x+9, ui_y+60, 211, 20)
			CLAMP_SIZE = Draw.Number('Clamp Scale: ', EVENT_NONE, ui_x+9, ui_y+39, 130, 21, CLAMP_SIZE.val, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)')
			POLYGROUPS = Draw.Toggle('Poly Groups', EVENT_REDRAW, ui_x+144, ui_y+39, 90, 21, POLYGROUPS.val, 'Import OBJ groups as vertex groups.', do_polygroups)
			IMAGE_SEARCH = Draw.Toggle('Image Search', EVENT_NONE, ui_x+239, ui_y+39, 100, 21, IMAGE_SEARCH.val, 'Search subdirs for any assosiated images (Warning, may be slow)')
			Draw.BeginAlign()
			Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 21, 'Load the wiki page for this script', do_help)
			Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 21, '', obj_ui_set_event)
			Draw.PushButton('Import', EVENT_IMPORT, ui_x+229, ui_y+9, 110, 21, 'Import with these settings', obj_ui_set_event)
			Draw.EndAlign()
예제 #3
0
		def obj_ui():
			ui_x, ui_y = GLOBALS['MOUSE']
			
			# Center based on overall pup size
			ui_x -= 165
			ui_y -= 140
			
			global EXPORT_APPLY_MODIFIERS, EXPORT_ROTX90, EXPORT_TRI, EXPORT_EDGES,\
				EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\
				EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\
				EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\
				EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER,\
				EXPORT_POLYGROUPS, EXPORT_CURVE_AS_NURBS

			Draw.Label('Context...', ui_x+9, ui_y+239, 220, 20)
			Draw.BeginAlign()
			EXPORT_SEL_ONLY = Draw.Toggle('Selection Only', EVENT_NONE, ui_x+9, ui_y+219, 110, 20, EXPORT_SEL_ONLY.val, 'Only export objects in visible selection. Else export whole scene.')
			EXPORT_ALL_SCENES = Draw.Toggle('All Scenes', EVENT_NONE, ui_x+119, ui_y+219, 110, 20, EXPORT_ALL_SCENES.val, 'Each scene as a separate OBJ file.')
			EXPORT_ANIMATION = Draw.Toggle('Animation', EVENT_NONE, ui_x+229, ui_y+219, 110, 20, EXPORT_ANIMATION.val, 'Each frame as a numbered OBJ file.')
			Draw.EndAlign()
			
			
			Draw.Label('Output Options...', ui_x+9, ui_y+189, 220, 20)
			Draw.BeginAlign()
			EXPORT_APPLY_MODIFIERS = Draw.Toggle('Apply Modifiers', EVENT_REDRAW, ui_x+9, ui_y+170, 110, 20, EXPORT_APPLY_MODIFIERS.val, 'Use transformed mesh data from each object. May break vert order for morph targets.', do_split)
			EXPORT_ROTX90 = Draw.Toggle('Rotate X90', EVENT_NONE, ui_x+119, ui_y+170, 110, 20, EXPORT_ROTX90.val, 'Rotate on export so Blenders UP is translated into OBJs UP')
			EXPORT_COPY_IMAGES = Draw.Toggle('Copy Images', EVENT_NONE, ui_x+229, ui_y+170, 110, 20, EXPORT_COPY_IMAGES.val, 'Copy image files to the export directory, never overwrite.')
			Draw.EndAlign()
			
			
			Draw.Label('Export...', ui_x+9, ui_y+139, 220, 20)
			Draw.BeginAlign()
			EXPORT_EDGES = Draw.Toggle('Edges', EVENT_NONE, ui_x+9, ui_y+120, 50, 20, EXPORT_EDGES.val, 'Edges not connected to faces.')
			EXPORT_TRI = Draw.Toggle('Triangulate', EVENT_NONE, ui_x+59, ui_y+120, 70, 20, EXPORT_TRI.val, 'Triangulate quads.')
			Draw.EndAlign()
			Draw.BeginAlign()
			EXPORT_MTL = Draw.Toggle('Materials', EVENT_NONE, ui_x+139, ui_y+120, 70, 20, EXPORT_MTL.val, 'Write a separate MTL file with the OBJ.')
			EXPORT_UV = Draw.Toggle('UVs', EVENT_NONE, ui_x+209, ui_y+120, 31, 20, EXPORT_UV.val, 'Export texface UV coords.')
			Draw.EndAlign()
			Draw.BeginAlign()
			EXPORT_NORMALS = Draw.Toggle('Normals', EVENT_NONE, ui_x+250, ui_y+120, 59, 20, EXPORT_NORMALS.val, 'Export vertex normal data (Ignored on import).')
			EXPORT_NORMALS_HQ = Draw.Toggle('HQ', EVENT_NONE, ui_x+309, ui_y+120, 31, 20, EXPORT_NORMALS_HQ.val, 'Calculate high quality normals for rendering.')
			Draw.EndAlign()
			EXPORT_POLYGROUPS = Draw.Toggle('Polygroups', EVENT_REDRAW, ui_x+9, ui_y+95, 120, 20, EXPORT_POLYGROUPS.val, 'Export vertex groups as OBJ groups (one group per face approximation).')
			
			EXPORT_CURVE_AS_NURBS = Draw.Toggle('Nurbs', EVENT_NONE, ui_x+139, ui_y+95, 100, 20, EXPORT_CURVE_AS_NURBS.val, 'Export 3D nurbs curves and polylines as OBJ curves, (bezier not supported).')
			
			
			Draw.Label('Blender Objects as OBJ:', ui_x+9, ui_y+59, 220, 20)
			Draw.BeginAlign()
			EXPORT_BLEN_OBS = Draw.Toggle('Objects', EVENT_REDRAW, ui_x+9, ui_y+39, 60, 20, EXPORT_BLEN_OBS.val, 'Export blender objects as "OBJ objects".', do_split)
			EXPORT_GROUP_BY_OB = Draw.Toggle('Groups', EVENT_REDRAW, ui_x+69, ui_y+39, 60, 20, EXPORT_GROUP_BY_OB.val, 'Export blender objects as "OBJ Groups".', do_split)
			EXPORT_GROUP_BY_MAT = Draw.Toggle('Material Groups', EVENT_REDRAW, ui_x+129, ui_y+39, 100, 20, EXPORT_GROUP_BY_MAT.val, 'Group by materials.', do_split)
			Draw.EndAlign()
			
			EXPORT_KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+239, ui_y+39, 100, 20, EXPORT_KEEP_VERT_ORDER.val, 'Keep vert and face order, disables some other options. Use for morph targets.', do_vertorder)
			
			Draw.BeginAlign()
			Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 20, 'Load the wiki page for this script', do_help)
			Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 20, '', obj_ui_set_event)
			Draw.PushButton('Export', EVENT_EXPORT, ui_x+229, ui_y+9, 110, 20, 'Export with these settings', obj_ui_set_event)
			Draw.EndAlign()
예제 #4
0
def draw_gui():

	global str_gmdc_filename, str_cres_filename, str_resource_name, btn_name_suffix, \
		btn_export_tangents, btn_export_rigging, btn_export_bmesh, btn_save_log, \
		menu_export_morphs, btn_use_obj_props, str_bmesh_name

	pos_y = 340 ; MAX_PATH = 200

	# frame

	Blender.BGL.glColor3f(0.75, 0.75, 0.75)
	Blender.BGL.glRecti(10, 10, 430, pos_y)

	pos_y-= 30

	# plugin's header

	s = "GMDC Exporter (TS2)"
	Blender.BGL.glColor3f(0.8, 0.8, 0.8)
	Blender.BGL.glRecti(10, pos_y, 430, pos_y+30)
	Draw.Label(s, 20, pos_y, 400, 30)

	pos_y-= 30

	# GMDC file selector

	Draw.Label("GMDC file (output)", 20, pos_y, 200, 20)
	pos_y-= 20
	Draw.BeginAlign()
	str_gmdc_filename = Draw.String("", 0x10, 20, pos_y, 300, 20, str_gmdc_filename.val, MAX_PATH, "Path to GMDC file")
	Draw.PushButton("Select file", 0x11, 320, pos_y, 100, 20, "Open file browser")
	Draw.EndAlign()

	pos_y-= 35

	# geometry name

	Blender.BGL.glColor3f(0.7, 0.7, 0.7)
	Blender.BGL.glRecti(20, pos_y-60, 420, pos_y+20)

	Draw.Label("SGResource name (optional)", 25, pos_y, 400, 20) ; pos_y-= 20
	Draw.Label("If not provided then GMDC filename is used", 25, pos_y, 400, 20) ; pos_y-= 30
	Draw.BeginAlign()
	str_resource_name = Draw.String("", 0x50, 70, pos_y, 180, 20, str_resource_name.val, 50, "SGResource name of this geometry")
	btn_name_suffix = Draw.Toggle("_tslocator_gmdc", 0x51, 250, pos_y, 120, 20, btn_name_suffix.val, "Add default suffix")
	Draw.EndAlign()

	pos_y-= 45

	# options

	Draw.BeginAlign()
	btn_export_rigging = Draw.Toggle("Rigging", 0x31, 20, pos_y, 100, 20, btn_export_rigging.val, "Export rigging data (bone indices, weights)")
	btn_export_tangents = Draw.Toggle("Tangents", 0x32, 120, pos_y, 100, 20, btn_export_tangents.val, "Export tangents (required for bump mapping)")
	btn_export_bmesh = Draw.Toggle("Bound. mesh", 0x33, 220, pos_y, 100, 20, btn_export_bmesh.val, "Export bounding geometry")
	btn_save_log = Draw.Toggle("Save log", 0x34, 320, pos_y, 100, 20, btn_save_log.val, "Write script's log data into file *.export_log.txt")
	Draw.EndAlign()

	pos_y-= 30

	Draw.BeginAlign()
	menu_export_morphs = Draw.Menu("Export morphs %t|Do not export morphs %x0|Diff. in v.coords only %x1|Diff. in v.coords and normals %x2", 0x35, 20, pos_y, 200, 20, menu_export_morphs.val)
	btn_use_obj_props = Draw.Toggle("Use object properties", 0x36, 220, pos_y, 200, 20, btn_use_obj_props.val, "Properties can be assigned in logic panel")
	Draw.EndAlign()

	pos_y-= 30

	# bounding mesh name

	Draw.Label("Bounding mesh:", 20, pos_y, 100, 20)
	str_bmesh_name = Draw.String("", 0x40, 120, pos_y, 200, 20, str_bmesh_name.val, 50, "Name of mesh object that will be exported as bounding mesh")

	pos_y-= 50

	# buttons

	Draw.BeginAlign()
	Draw.PushButton("Export", 1, 120, pos_y, 100, 30, "Export geometry (Ctrl + Enter)")
	Draw.PushButton("Exit", 0, 220, pos_y, 100, 30, "Terminate the script (Esc)")
	Draw.EndAlign()
예제 #5
0
def draw_gui():

    global str_gmdc_filename, str_cres_filename, btn_import_bmesh, btn_all_bones, btn_remove_doubles, btn_save_log

    pos_y = 230
    MAX_PATH = 200

    # frame

    Blender.BGL.glColor3f(0.75, 0.75, 0.75)
    Blender.BGL.glRecti(10, 10, 430, pos_y)

    pos_y -= 30

    # plugin's header

    s = "GMDC Importer (TS2)"
    Blender.BGL.glColor3f(0.8, 0.8, 0.8)
    Blender.BGL.glRecti(10, pos_y, 430, pos_y + 30)
    Draw.Label(s, 20, pos_y, 400, 30)

    pos_y -= 30

    # GMDC file selector

    Draw.Label("GMDC file", 20, pos_y, 200, 20)
    pos_y -= 20
    Draw.BeginAlign()
    str_gmdc_filename = Draw.String("", 0x10, 20, pos_y, 300, 20,
                                    str_gmdc_filename.val, MAX_PATH,
                                    "Path to GMDC file")
    Draw.PushButton("Select file", 0x11, 320, pos_y, 100, 20,
                    "Open file browser")
    Draw.EndAlign()

    pos_y -= 30

    # resource node file selector

    Draw.Label("Resource node file (optional)", 20, pos_y, 200, 20)
    pos_y -= 20
    Draw.BeginAlign()
    str_cres_filename = Draw.String(
        "", 0x20, 20, pos_y, 300, 20, str_cres_filename.val, MAX_PATH,
        "Path to resource node file (CRES; optional, but recommended)")
    Draw.PushButton("Select file", 0x21, 320, pos_y, 100, 20,
                    "Open file browser")
    Draw.EndAlign()

    pos_y -= 35

    # options

    Draw.BeginAlign()
    btn_import_bmesh = Draw.Toggle("Bound. mesh", 0x31, 20, pos_y, 100, 20,
                                   btn_import_bmesh.val,
                                   "Import bounding geometry")
    btn_remove_doubles = Draw.Toggle(
        "Rm. doubles", 0x32, 120, pos_y, 100, 20, btn_remove_doubles.val,
        "If some vertices differ only in texture coordinates, then they are merged together (removes seams)"
    )
    btn_all_bones = Draw.Toggle(
        "All bones", 0x33, 220, pos_y, 100, 20, btn_all_bones.val,
        "Import all bones/transforms; otherwise, used bones only")
    btn_save_log = Draw.Toggle(
        "Save log", 0x34, 320, pos_y, 100, 20, btn_save_log.val,
        "Write script's log data into file *.import_log.txt")
    Draw.EndAlign()

    pos_y -= 45

    # buttons

    Draw.BeginAlign()
    Draw.PushButton("Import", 1, 120, pos_y, 100, 30,
                    "Import geometry (Ctrl + Enter)")
    Draw.PushButton("Exit", 0, 220, pos_y, 100, 30,
                    "Terminate the script (Esc)")
    Draw.EndAlign()