The rules have been updated, read them now: Rules!

Granny .GR2 Reader plugin for Noesis

Post questions about game models here, or help out others!
jayn23
mega-veteran
mega-veteran
Posts: 173
Joined: Sun Jul 17, 2011 9:30 pm
Has thanked: 50 times
Been thanked: 157 times

Re: Granny .GR2 Reader plugin for Noesis

Post by jayn23 » Wed Feb 10, 2021 7:53 pm

Pepsee wrote:
Mon Jan 25, 2021 11:11 pm
Hey, I'm really loving this but really looking forward to some love for Mechassault 2 and some support be added for the animation .GR2 files. So far I can only open up and preview the base skeleton, but animations are another story.. I attached some skeletons and animations for a more in-depth analysis.
Thanks yet again for this great plugin!

Here are the animation samples:
https://mega.nz/file/9Z5WhC7I#0lFeK8kae ... u_3MpSWzsE
Hi,

I have tried using vtr_skeleton with vtr_run and with vtr_walk and animations seems to work with both of them, can you please let me know which animations aren't working and what skeleton is associated with the animation.

edit:
also tried P_G_skeleton with P_G_run_pilot and aniamtion works great

User avatar
Pepsee
mega-veteran
mega-veteran
Posts: 165
Joined: Fri Mar 04, 2016 9:26 pm
Has thanked: 27 times
Been thanked: 5 times

Re: Granny .GR2 Reader plugin for Noesis

Post by Pepsee » Thu Feb 11, 2021 8:40 am

What version of the script? Latest release?

User avatar
Pepsee
mega-veteran
mega-veteran
Posts: 165
Joined: Fri Mar 04, 2016 9:26 pm
Has thanked: 27 times
Been thanked: 5 times

Re: Granny .GR2 Reader plugin for Noesis

Post by Pepsee » Fri Feb 12, 2021 2:02 pm

Thank you so much for your support and implication! Finally able to properly port this to Garry's Mod, now I'm going to try to have them scripted so people can have chaotic PVP/PVE fun with them!

Image
Image
Image
Image
Image

jayn23
mega-veteran
mega-veteran
Posts: 173
Joined: Sun Jul 17, 2011 9:30 pm
Has thanked: 50 times
Been thanked: 157 times

Re: Granny .GR2 Reader plugin for Noesis

Post by jayn23 » Fri Feb 12, 2021 2:04 pm

Version 1.2.6.1 Release

Thanks to Pepsee i found a missing parameter when converting old type animations to new type that i haven't encountered yet,
now all tested Mechassault 2 animations work.
fmt_GR2reader1261.rar
You do not have the required permissions to view the files attached to this post.

noire90
ultra-n00b
Posts: 4
Joined: Mon Jan 13, 2020 12:49 am

Re: Granny .GR2 Reader plugin for Noesis

Post by noire90 » Sat Feb 20, 2021 11:41 am

It is possible to import scene maps from Divinity Original Sin 2 with this plugin?

jayn23
mega-veteran
mega-veteran
Posts: 173
Joined: Sun Jul 17, 2011 9:30 pm
Has thanked: 50 times
Been thanked: 157 times

Re: Granny .GR2 Reader plugin for Noesis

Post by jayn23 » Sat Feb 20, 2021 10:57 pm

noire90 wrote:
Sat Feb 20, 2021 11:41 am
It is possible to import scene maps from Divinity Original Sin 2 with this plugin?
Well my intrest is more with charecter models so i have only tested those, but if the scene maps are in .gr2 format i dont see any reason they wont work.

TheFalcon19
ultra-n00b
Posts: 5
Joined: Wed Sep 25, 2019 2:42 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Granny .GR2 Reader plugin for Noesis

Post by TheFalcon19 » Sat Feb 27, 2021 4:21 am

Looked into some ESO models that have the uv issue and it looks like they simply have the two uv channels in shorts instead of floats.

jayn23
mega-veteran
mega-veteran
Posts: 173
Joined: Sun Jul 17, 2011 9:30 pm
Has thanked: 50 times
Been thanked: 157 times

Re: Granny .GR2 Reader plugin for Noesis

Post by jayn23 » Mon Mar 01, 2021 8:36 pm

TheFalcon19 wrote:
Sat Feb 27, 2021 4:21 am
Looked into some ESO models that have the uv issue and it looks like they simply have the two uv channels in shorts instead of floats.
Hi TheFalcon19,

In the past i remembered checking UV for shorts and i didnt find anything, but thanks to your post i decided to take another look,
at first i didnt find anything until i rememberedi reading somewhere about normlizing shorts to get floats or something similer, once i went down that path i figured it out , goes to show you what exprience gives you :D

by the way it works with signed shorts only from what i tested.

ill be uploading a new version in a day or so.

jayn23
mega-veteran
mega-veteran
Posts: 173
Joined: Sun Jul 17, 2011 9:30 pm
Has thanked: 50 times
Been thanked: 157 times

Re: Granny .GR2 Reader plugin for Noesis

Post by jayn23 » Tue Mar 02, 2021 9:48 am

Version 1.2.7 Release

1. Now supports UV for ESO static meshes
2. Added Support for Bauldrs Gate 3 .PAK files archive - has known issue with LowTex.pak - files are extracted but they arent usable , seem to be missing headers at the very least, anyway i dont have any plans to try and get them working.

edit:
I forgot to add that in order to get UV for ESO static meshes i added a game tag, GAME_TAG_ESO_STATIC = 1 since there was no way for the script to tell the diffrence between these meshes and any other.
its currently on by deafult and should not cause any issues for most games, but if any game get distorted UV try diabling it.

The Support for BG3 .PAK was added, to make script a bit more about BG3 which was my main reason for making it, and to get some practice with Archives and lz4 compression.

I have a weird issue with extractor, maybe someone can help me figure out what the issue is.
as you can see in gif below, when i double click file for export in runs thru the entire script without actually exporting the data.
i can then export normaly, and when i close the extractor it again runs thru the entire script without actually exporting the data.
as you can imagine for big files it causes a huge delay in loading and when closing as we actually run thru the file 3 times.

Image

Extractor code:

Code: Select all

from os.path import *
from math import *
from inc_noesis import *
import struct
import os
import io


def registerNoesisTypes(): 
    handle = noesis.register("Bauldrs Gate 3 Archive", ".pak")
    noesis.setHandlerExtractArc(handle, extractPAK)
    #opens debug consle
    noesis.logPopup()
    return 1
    
def noepyCheckType(data):
    '''Verify that the format is supported by this plugin. Default yes'''
    return 1
    

#get file and directory names from string 
def getfilename(name):
    array = name.split('/')
    filename = array[len(array)-1]
    num = len(name) - len(filename)
    directoryname = name[:num]

    return filename, directoryname

    
    
def extractPAK(fileName, fileLen, justChecking):
        

        
def extractPAK(fileName, fileLen, justChecking):
                   
    with open(fileName, "rb") as f:
        
        if justChecking:
            return 1
                
        f.seek(4,0) # magic
        version = struct.unpack("<I",f.read(4))[0] 

        #Get file names and parameters
        table_offset = struct.unpack("<Q",f.read(8))[0]
        f.seek(table_offset,0)
        NumFiles = struct.unpack("<I",f.read(4))[0] 
        CompressedSize = struct.unpack("<I",f.read(4))[0] 

        #Save current location
        TableOffset = f.tell()
        UncompressedSize = NumFiles * 296
        
        #Decompress using lz4.block format
        DecompressedData = rapi.decompLZ4(f.read(CompressedSize),UncompressedSize)

        #Convert data to IO format       
        DecompressStream = NoeBitStream(bytes(DecompressedData), NOE_LITTLEENDIAN)
        
        for i in range(NumFiles): 
            string = noeStrFromBytes(DecompressStream.readBytes(256), "UTF8")
            offset = DecompressStream.readUInt64()
            CompressedSize = DecompressStream.readUInt64()
            UncompressedSize = DecompressStream.readUInt64()
            dummy = DecompressStream.readUInt64()
            crc = DecompressStream.readUInt()
            dummy = DecompressStream.readUInt()

            f.seek(offset,0)
            #if file is compressed

            if UncompressedSize != 0 and fileName[-10:] != 'LowTex.pak':       
                FileDecompressedData = rapi.decompLZ4(f.read(CompressedSize),UncompressedSize)

            else:
                #data is not compressed
                #print("uncompressed file" + string)
                FileDecompressedData = f.read(CompressedSize)

            filename, directoryname = getfilename(string)
            print("{} {}".format(i,directoryname + filename))
            rapi.exportArchiveFile(directoryname + filename , FileDecompressedData)  
            
        
    return 1   
You do not have the required permissions to view the files attached to this post.
Last edited by jayn23 on Wed Mar 03, 2021 8:05 pm, edited 3 times in total.

User avatar
zardalu
veteran
Posts: 99
Joined: Sat Sep 13, 2008 3:13 pm
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: Granny .GR2 Reader plugin for Noesis

Post by zardalu » Wed Mar 03, 2021 1:52 pm

Amazing work! For some reason when I try to export any ESO static mesh, Noesis crashes. I am experimenting to see if I can figure it out. Thanks for your work

Post Reply