Example #1
0
def build(input_directory_path, output_directory_path):
    '''
    Walks the source directory and converts all wav, ogg and MP3 files and
    to a Cricket Audio Stream then outputs them to the destination path.
    
    :Authors: Ian Copland
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    '''
    print("-----------------------------------------")
    print("           Building Music")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(output_directory_path, current_input_directory_path[len(input_directory_path):]);

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".wav") or file_system_utils.has_extension(file_name, ".mp3") or file_system_utils.has_extension(file_name, ".ogg"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path);

                input_file_path = os.path.join(current_input_directory_path, file_name)
                output_file_path = os.path.splitext(os.path.join(current_output_directory_path, file_name))[0] + ".cks"
                build_music(input_file_path, output_file_path)

    print (" ")
Example #2
0
def build(input_directory_path, output_directory_path):
    """
    Walks the input directory and converts all xls sheets into cstext
    
    :Authors: S Downie
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    """
    print("-----------------------------------------")
    print("             Building Text")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, input_sub_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(output_directory_path, current_input_directory_path[len(input_directory_path):])

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".xls"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path);
                
                for language in LANGUAGES:
                    input_file_path = os.path.join(current_input_directory_path, file_name);
                    output_file_path = os.path.splitext(os.path.join(current_output_directory_path, file_name))[0] + ".cstext"
                    
                    if language is not "en":
                        output_file_path = os.path.splitext(output_file_path)[0] + "." + language + ".cstext"

                    build_text(input_file_path, output_file_path, language)

    print (" ")
def build(input_path, output_path):

	print("-----------------------------------------")
	print("           Building atlases")
	print("-----------------------------------------")

	if(input_path.endswith("/") == False):
		input_path = input_path + "/"

	if(output_path.endswith("/") == False):
		output_path = output_path + "/"

	if os.path.exists(output_path) == True:
		shutil.rmtree(output_path)

	for directory, sub_dirs, file_names in os.walk(input_path):
		output_dir = os.path.join(output_path, directory[len(input_path):len(directory)]);
		if len(sub_dirs) == 0:
			contains_png = False
			for file_name in file_names:
				if file_system_utils.has_extension(file_name, ".png") == True:
					contains_png = True
					break

			if contains_png == True:
				if os.path.exists(output_dir) == False:
					os.makedirs(output_dir);
				build_altases_in_directory(directory, output_dir, file_names)

	print(" ")
Example #4
0
def build(input_path, output_path):
	print("-----------------------------------------")
	print("           Building Textures")
	print("-----------------------------------------")

	if(input_path.endswith("/") == False):
		input_path = input_path + "/"

	if(output_path.endswith("/") == False):
		output_path = output_path + "/"

	file_system_utils.delete_directory(output_path)

	for directory, sub_dirs, filenames in os.walk(input_path):
		input_dir = directory
		output_dir = os.path.join(output_path, input_dir[len(input_path):len(input_dir)]);

		for filename in filenames:
			if file_system_utils.has_extension(filename, ".png") == True:
				if os.path.exists(output_dir) == False:
					os.makedirs(output_dir);
				
				output_file_path = os.path.splitext(os.path.join(output_dir, filename))[0] + ".csimage"
				build_texture(os.path.join(directory, filename), output_file_path)

	print (" ")
def build(input_path, output_path):
    print("-----------------------------------------")
    print("             Building Text")
    print("-----------------------------------------")

    if input_path.endswith("/") == False:
        input_path = input_path + "/"

    if output_path.endswith("/") == False:
        output_path = output_path + "/"

    file_system_utils.delete_directory(output_path)

    for directory, sub_dirs, filenames in os.walk(input_path):
        input_dir = directory
        output_dir = os.path.join(output_path, input_dir[len(input_path) : len(input_dir)])

        for filename in filenames:
            if file_system_utils.has_extension(filename, ".xls") == True:
                if os.path.exists(output_dir) == False:
                    os.makedirs(output_dir)

                for language in languages:

                    output_file_path = os.path.splitext(os.path.join(output_dir, filename))[0] + ".cstext"
                    if language is not "en":
                        output_file_path = os.path.splitext(output_file_path)[0] + "." + language + ".cstext"

                    build_text(os.path.join(directory, filename), output_file_path, language)

    print(" ")
def build(input_path, output_path):

    print("-----------------------------------------")
    print("           Building atlases")
    print("-----------------------------------------")

    if (input_path.endswith("/") == False):
        input_path = input_path + "/"

    if (output_path.endswith("/") == False):
        output_path = output_path + "/"

    if os.path.exists(output_path) == True:
        shutil.rmtree(output_path)

    for directory, sub_dirs, file_names in os.walk(input_path):
        output_dir = os.path.join(output_path,
                                  directory[len(input_path):len(directory)])
        if len(sub_dirs) == 0:
            contains_png = False
            for file_name in file_names:
                if file_system_utils.has_extension(file_name, ".png") == True:
                    contains_png = True
                    break

            if contains_png == True:
                if os.path.exists(output_dir) == False:
                    os.makedirs(output_dir)
                build_altases_in_directory(directory, output_dir, file_names)

    print(" ")
Example #7
0
def build(input_directory_path, output_directory_path):
    """
    Walks the input directory and converts all pngs into csimages
    
    :Authors: S Downie
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    """
    print("-----------------------------------------")
    print("           Building Textures")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(output_directory_path, current_input_directory_path[len(input_directory_path):]);

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".png"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path);

                input_file_path = os.path.join(current_input_directory_path, file_name)
                output_file_path = os.path.splitext(os.path.join(current_output_directory_path, file_name))[0] + ".csimage"
                build_texture(input_file_path, output_file_path)

    print (" ")
def build(input_path, output_path):

    print("-----------------------------------------")
    print("           Building Models")
    print("-----------------------------------------")

    if (input_path.endswith("/") == False):
        input_path = input_path + "/"

    if (output_path.endswith("/") == False):
        output_path = output_path + "/"

    file_system_utils.delete_directory(output_path)

    for directory, sub_dirs, filenames in os.walk(input_path):
        input_dir = directory
        output_dir = os.path.join(output_path,
                                  input_dir[len(input_path):len(input_dir)])

        for filename in filenames:
            if file_system_utils.has_extension(filename, ".dae") == True:
                if os.path.exists(output_dir) == False:
                    os.makedirs(output_dir)

                output_file_path = os.path.splitext(
                    os.path.join(output_dir, filename))[0] + ".csmodel"
                build_model(os.path.join(directory, filename),
                            output_file_path)

    print(" ")
def build(input_directory_path, output_directory_path):
    """
    Walks the input directory and packs all pngs in each folder into an atlas
    for that folder.
    
    :Authors: S Downie
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    """
    print("-----------------------------------------")
    print("           Building atlases")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(output_directory_path, current_input_directory_path[len(input_directory_path):]);

        if len(sub_input_directory_paths) == 0:
            for file_name in file_names:
                if file_system_utils.has_extension(file_name, ".png") == True:
                    contains_png = True
                    break
            
            if os.path.exists(current_output_directory_path) == False:
                os.makedirs(current_output_directory_path);

            build_altases_in_directory(current_input_directory_path, current_output_directory_path, file_names)

    print(" ")
Example #10
0
def build(input_directory_path, output_directory_path):
    """
    Walks the input directory and converts all DAEs into csanims.
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    """
    print("-----------------------------------------")
    print("           Building Animations")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(
            output_directory_path, current_input_directory_path[len(input_directory_path) :]
        )

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".dae"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path)

                input_file_path = os.path.join(current_input_directory_path, file_name)
                output_file_path = (
                    os.path.splitext(os.path.join(current_output_directory_path, file_name))[0] + ".csanim"
                )
                build_animation(input_file_path, output_file_path)

    print(" ")
Example #11
0
def build(input_directory_path, output_directory_path):
    """
    Walks the input directory and converts all DAEs into csmodels.
    
    :Authors: S Downie
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    """
    print("-----------------------------------------")
    print("           Building Static Models")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(output_directory_path, current_input_directory_path[len(input_directory_path):]);

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".dae"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path);

                input_file_path = os.path.join(current_input_directory_path, file_name)
                output_file_path = os.path.splitext(os.path.join(current_output_directory_path, file_name))[0] + ".csmodel"
                build_model(input_file_path, output_file_path)

    print (" ")
def build(input_path, output_path):
	print("-----------------------------------------")
	print("             Building Text")
	print("-----------------------------------------")

	if(input_path.endswith("/") == False):
		input_path = input_path + "/"

	if(output_path.endswith("/") == False):
		output_path = output_path + "/"

	file_system_utils.delete_directory(output_path)

	for directory, sub_dirs, filenames in os.walk(input_path):
		input_dir = directory
		output_dir = os.path.join(output_path, input_dir[len(input_path):len(input_dir)]);

		for filename in filenames:
			if file_system_utils.has_extension(filename, ".xls") == True:
				if os.path.exists(output_dir) == False:
					os.makedirs(output_dir);
				
				for language in languages:

					output_file_path = os.path.splitext(os.path.join(output_dir, filename))[0]+".cstext"
					if(language is not "en"):
						output_file_path = os.path.splitext(output_file_path)[0]+"."+language+".cstext"

					build_text(os.path.join(directory, filename), output_file_path, language)

	print (" ")
Example #13
0
def build(input_directory_path, output_directory_path):
    '''
    Walks the source directory and converts all ckbx files to a Cricket Audio 
    Bank then outputs them to the destination path.
    
    :Authors: Ian Copland
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    '''
    print("-----------------------------------------")
    print("           Building SFX")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(input_directory_path):
        current_output_directory_path = os.path.join(output_directory_path, current_input_directory_path[len(input_directory_path):]);

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".ckbx"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path);

                input_file_path = os.path.join(current_input_directory_path, file_name)
                output_file_path = os.path.splitext(os.path.join(current_output_directory_path, file_name))[0] + ".ckb"
                build_sfx(input_file_path, output_file_path)

    print (" ")
def build_altases_in_directory(input_dir, output_dir, file_names):
	
	remains = [file_name for file_name in file_names if file_system_utils.has_extension(file_name, ".png")]

	while len(remains) > 0:
		tags = get_tags_from_file_name(remains[0])
		tagged_files = [file_name for file_name in remains if file_name_has_tags(file_name, tags)]
		build_atlas_with_tags(input_dir, output_dir, tagged_files, tags);
		[remains.remove(file_name) for file_name in tagged_files]
Example #15
0
def build(input_directory_path, output_directory_path):
    '''
    Walks the source directory and converts all wav, ogg and MP3 files and
    to a Cricket Audio Stream then outputs them to the destination path.
    
    :Authors: Ian Copland
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    '''
    print("-----------------------------------------")
    print("           Building Music")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, sub_input_directory_paths, file_names in os.walk(
            input_directory_path):
        current_output_directory_path = os.path.join(
            output_directory_path,
            current_input_directory_path[len(input_directory_path):])

        for file_name in file_names:
            if file_system_utils.has_extension(
                    file_name, ".wav") or file_system_utils.has_extension(
                        file_name, ".mp3") or file_system_utils.has_extension(
                            file_name, ".ogg"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path)

                input_file_path = os.path.join(current_input_directory_path,
                                               file_name)
                output_file_path = os.path.splitext(
                    os.path.join(current_output_directory_path,
                                 file_name))[0] + ".cks"
                build_music(input_file_path, output_file_path)

    print(" ")
def build_altases_in_directory(input_dir, output_dir, file_names):

    remains = [
        file_name for file_name in file_names
        if file_system_utils.has_extension(file_name, ".png")
    ]

    while len(remains) > 0:
        tags = get_tags_from_file_name(remains[0])
        tagged_files = [
            file_name for file_name in remains
            if file_name_has_tags(file_name, tags)
        ]
        build_atlas_with_tags(input_dir, output_dir, tagged_files, tags)
        [remains.remove(file_name) for file_name in tagged_files]
def build_altases_in_directory(input_directory_path, output_directory_path, file_names):
    """
    Builds each of the different atlases in the given directory. Different atlases
    are build for assets with different "resource tags", i.e Image.low.png and
    Image.high.png would end up on different texture atlases.
    
    :Authors: Ian Copland
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    :param file_names: The list of file names.
    """
    remains = [file_name for file_name in file_names if file_system_utils.has_extension(file_name, ".png")]

    while len(remains) > 0:
        tags = get_tags_from_file_name(remains[0])
        tagged_files = [file_name for file_name in remains if file_name_has_tags(file_name, tags)]
        build_atlas_with_tags(input_directory_path, output_directory_path, tagged_files, tags);
        [remains.remove(file_name) for file_name in tagged_files]
Example #18
0
def build(input_directory_path, output_directory_path):
    """
    Walks the input directory and converts all xls sheets into cstext
    
    :Authors: S Downie
    
    :param input_directory_path: The input directory path.
    :param output_directory_path: The output directory path.
    """
    print("-----------------------------------------")
    print("             Building Text")
    print("-----------------------------------------")

    file_system_utils.delete_directory(output_directory_path)

    for current_input_directory_path, input_sub_directory_paths, file_names in os.walk(
            input_directory_path):
        current_output_directory_path = os.path.join(
            output_directory_path,
            current_input_directory_path[len(input_directory_path):])

        for file_name in file_names:
            if file_system_utils.has_extension(file_name, ".xls"):
                if os.path.exists(current_output_directory_path) == False:
                    os.makedirs(current_output_directory_path)

                for language in LANGUAGES:
                    input_file_path = os.path.join(
                        current_input_directory_path, file_name)
                    output_file_path = os.path.splitext(
                        os.path.join(current_output_directory_path,
                                     file_name))[0] + ".cstext"

                    if language is not "en":
                        output_file_path = os.path.splitext(
                            output_file_path)[0] + "." + language + ".cstext"

                    build_text(input_file_path, output_file_path, language)

    print(" ")