Skip to content

Commit

Permalink
plugin - show classification and surface enums for JWE2 and PZ
Browse files Browse the repository at this point in the history
  • Loading branch information
HENDRIX-ZT2 committed Nov 13, 2023
1 parent e5cbba3 commit b752162
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
11 changes: 11 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ def draw(self, context):
row.prop(rb, "damping_3d")
row = layout.row(align=True)
row.prop(rb, "flag")
version = context.scene.cobra.version
if version in (48, 50):
row = layout.row(align=True)
row.prop(rb, "classification_pz")
row = layout.row(align=True)
row.prop(rb, "surface_pz")
elif version in (51, 52):
row = layout.row(align=True)
row.prop(rb, "classification_jwe2")
row = layout.row(align=True)
row.prop(rb, "surface_jwe2")


def draw_rigid_body_constraints_cobra(self, context):
Expand Down
25 changes: 22 additions & 3 deletions experimentals/physmat.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
from generated.formats.ovl_base import OvlContext
from generated.formats.physmat.compounds.PhysmatRoot import PhysmatRoot

files = ("C:/Users/arnfi/Desktop/pz.physmat", "C:/Users/arnfi/Desktop/jwe2.physmat")
for fp in files:
# PZ ms2
pz_classification_name = ['Animal', 'Animal_Bone', 'Animal_Box', 'Bedding', 'Building', 'Climbable', 'Coaster_Car', 'Enrichment_Object', 'Facility', 'Kinetic_Object', 'NoCollision', 'Prop', 'Scenery', 'Scenery_NoNavSource', 'Structure', 'Track', 'TreeBase', 'TreeBranch', 'TreeFoliage', 'TreeTrunk', 'UIElement']
pz_surface_name = ['Animal', 'Brick', 'Cloth', 'Concrete', 'Default', 'Default_Legacy_DO_NOT_USE', 'Dirt', 'Foliage', 'Glass', 'Grass', 'Ice', 'Leaves', 'Litter', 'Metal', 'Mud', 'Plastic', 'Poo', 'Rubber', 'Snow', 'Stone', 'Tree', 'Wood']

# JWE2 ms2
jwe2_classification_name = ['AIVehicle', 'AIVehicleObstacle', 'AviaryTourGate', 'Building', 'BuildingNoCameraObstacle', 'CameraObstacle', 'CarBody', 'CarObstacle', 'Debris', 'Default', 'Dinosaur', 'DinosaurNoFence', 'DinosaurNoVehicle', 'Drone', 'Foliage', 'Gate', 'GuestRagdoll', 'HatcheryGate', 'LagoonFloor', 'PaleoFoodPoint', 'Perch', 'PerchQuetz', 'Prop', 'PropNoCameraObstacle', 'TourGate', 'Vehicle']
jwe2_surface_name = ['BuildingBrick', 'BuildingConcrete', 'BuildingMetal', 'BuildingWood', 'CarBody', 'Debris', 'Default', 'DinosaurLimb', 'Drone', 'Gyrosphere', 'LagoonFloor', 'PaleoFoodPoint', 'PropMetal', 'PropPlastic', 'PropWooden', 'SceneryTree']

files = (
("C:/Users/arnfi/Desktop/pz.physmat", pz_classification_name, pz_surface_name),
("C:/Users/arnfi/Desktop/jwe2.physmat", jwe2_classification_name, jwe2_surface_name))
for fp, classification, surface in files:
with open(fp, "rb") as f:
mat = PhysmatRoot.from_stream(f, OvlContext())
print(mat)
for s in ("all_surfaces", "surface_res", "classnames"):
print("\n\n")
print(s)
names = []
for ind, offset in enumerate(getattr(mat, f"{s}_names")):
lut = None
if s in ("surface_res", "classnames"):
lut = getattr(mat, f"{s}_indices")[ind]
print(ind, mat.names.get_str_at(offset), lut)
else:
lut = f'{bin(getattr(mat, f"all_surfaces_flags")[ind])[2:]:>64s}'
name = mat.names.get_str_at(offset)
print(f'{ind:>3d}', lut, name)
names.append(name)
print(sorted(names))
print()
print(classification)
print(surface)
6 changes: 6 additions & 0 deletions modules/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def bulk_test_models(gui, start_dir, walk_ovls=True, walk_models=True):
hc_starts = {}
pack_bases = set()
chunk_mesh_zero = set()
classification_name = set()
surface_name = set()
joint_pad_size = {}
if walk_models:
with gui.reporter.log_duration("Walking MS2 files"):
Expand Down Expand Up @@ -218,6 +220,8 @@ def bulk_test_models(gui, start_dir, walk_ovls=True, walk_models=True):
hc_starts[hit.io_start-ms2_data.models_reader.io_start] = ms2_path_rel
flag_0.add(hit.flag_0)
flag_1.add(hit.flag_1)
classification_name.add(hit.classification_name)
surface_name.add(hit.surface_name)
if hit.dtype == CollisionType.MESH_COLLISION:
mesh_collision.add(ms2_path_rel)
else:
Expand Down Expand Up @@ -253,6 +257,8 @@ def bulk_test_models(gui, start_dir, walk_ovls=True, walk_models=True):
if shader_map:
print(f"shaders: {shaders}")
print(f"rigid_body_flags: {rigid_body_flags}")
print(f"classification_name: {sorted(classification_name)}")
print(f"surface_name: {sorted(surface_name)}")
# largest_zstring_buffers = sorted(joint_names_padding.keys())
# num = 10
# if len(largest_zstring_buffers) > num:
Expand Down
25 changes: 25 additions & 0 deletions plugin/utils/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class CobraMeshSettings(PropertyGroup):

)

class_pz = ['Animal', 'Animal_Bone', 'Animal_Box', 'Animal_Dead', 'Animal_Pouncing', 'Balloon', 'Bedding', 'Building', 'Character_InFlight', 'Character_Limb', 'Character_Limb_NoCollision', 'Character_Miscreant', 'Character_SoS', 'Climbable', 'Coaster', 'Coaster_Car', 'Coaster_Misc', 'Coaster_RacingCar', 'DevelopmentOnly_Ball', 'DevelopmentOnly_Character', 'Enrichment_Object', 'Facility', 'Kinetic_Object', 'Landscape', 'Navmesh', 'NoCollision', 'Poo', 'Prop', 'Ride', 'Scenery', 'Scenery_NoNavSource', 'Scenery_Vandalised', 'Structure', 'Track', 'TrackScenery', 'Track_Support', 'TreeBase', 'TreeBranch', 'TreeFoliage', 'TreeTrunk', 'Trigger_AnimalMemorialStaffThoughts', 'Trigger_AnimalObstruction', 'Trigger_EducationSource', 'Trigger_EscapedAnimal', 'Trigger_FacilityNegativeInfluence', 'Trigger_Grid', 'Trigger_GuestGate', 'Trigger_Inspector', 'Trigger_Presenter', 'Trigger_Queue', 'Trigger_Screen', 'Trigger_Security', 'UIElement', 'Water', 'WaterSpray', 'Wheel']
class_jwe2 = ['AIDrone', 'AIVehicle', 'AIVehicleFindGrid', 'AIVehicleObstacle', 'Audio', 'AviaryTourGate', 'Building', 'BuildingAIVehicleObstacle', 'BuildingNoCameraObstacle', 'CameraObstacle', 'CarBody', 'CarObstacle', 'Character', 'Debris', 'Default', 'Development', 'DevelopmentAll', 'Dinosaur', 'DinosaurCollisionProxy', 'DinosaurDinosaur', 'DinosaurNoBuilding', 'DinosaurNoCollision', 'DinosaurNoFence', 'DinosaurNoVehicle', 'DinosaurSelfCollision', 'Drone', 'Fence', 'FlyingVehicleObstacle', 'Foliage', 'Gate', 'Guest', 'GuestAvoidance', 'GuestObstacle', 'GuestRagdoll', 'HatcheryGate', 'InvisibleWall', 'LEGACY_DO_NOT_USE', 'LagoonFloor', 'Landscape', 'MissionTrigger', 'PaleoFoodPoint', 'Path', 'Perch', 'PerchQuetz', 'Prop', 'PropNoCameraObstacle', 'Pylon', 'Rotor', 'TinyDinosaurCollisionProxy', 'TourGate', 'Track', 'Tree', 'Vehicle', 'Wall', 'Water', 'WaterSplash', 'Wheel']
surfaces_pz = ['Animal', 'Brick', 'Character', 'Cloth', 'Concrete', 'Default', 'Default_Legacy_DO_NOT_USE', 'Dirt', 'Foliage', 'Frictionless', 'Glass', 'Grass', 'Ice', 'Leaves', 'Litter', 'Metal', 'Mud', 'Plastic', 'Poo', 'Rubber', 'Sand', 'Snow', 'Stone', 'Tree', 'Trigger', 'Tyre', 'Wood']
surfaces_jwe2 = ['BuildingBrick', 'BuildingConcrete', 'BuildingGlass', 'BuildingIce', 'BuildingMetal', 'BuildingSnow', 'BuildingWood', 'CarBody', 'CharacterCollidableLimb', 'CharacterFlying', 'CharacterNonCollidableLimb', 'Debris', 'Default', 'DinosaurLimb', 'DirtPath', 'Drone', 'Gyrosphere', 'LEGACY_DO_NOT_USE', 'LagoonFloor', 'LandscapeDefault', 'LandscapeDirt', 'LandscapeFoliage', 'LandscapeFrictionless', 'LandscapeGrass', 'LandscapeIce', 'LandscapeMetal', 'LandscapeMud', 'LandscapePondBottom', 'LandscapeSand', 'LandscapeSnow', 'LandscapeStone', 'LandscapeWood', 'LandscapeWoodHollow', 'NonCollidableLimb', 'PaleoFoodPoint', 'PropLeaves', 'PropLitter', 'PropMetal', 'PropPlastic', 'PropStone', 'PropTree', 'PropWooden', 'SceneryDefault', 'SceneryTree', 'StructureFence', 'StructurePath', 'StructurePylon', 'StructureTrack', 'StructureWall', 'Water']


class CobraCollisionSettings(PropertyGroup):
air_resistance: bpy.props.FloatVectorProperty(
Expand Down Expand Up @@ -64,3 +69,23 @@ class CobraCollisionSettings(PropertyGroup):
description='Current state of this rigidbody',
items=[(item.name, item.name, "") for i, item in enumerate(RigidBodyFlag)],
)
classification_pz: EnumProperty(
name='Classification',
description='Hitcheck Classification Name for Planet Zoo',
items=[(name, name, "") for name in class_pz],
)
classification_jwe2: EnumProperty(
name='Classification',
description='Hitcheck Classification Name for Jurassic World Evolution 2',
items=[(name, name, "") for name in class_jwe2],
)
surface_pz: EnumProperty(
name='Surface',
description='Hitcheck Surface Name for Planet Zoo',
items=[(name, name, "") for name in surfaces_pz],
)
surface_jwe2: EnumProperty(
name='Surface',
description='Hitcheck Surface Name for Jurassic World Evolution 2',
items=[(name, name, "") for name in surfaces_jwe2],
)
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cc80d1b3e - Sun Nov 12 23:20:30 2023 +0100
e5cbba344 - Mon Nov 13 16:54:31 2023 +0100

0 comments on commit b752162

Please sign in to comment.