Skip to content

Commit

Permalink
Merge pull request #1 from ZeroGravitasIndeed/main
Browse files Browse the repository at this point in the history
Minor Collection adjustments
  • Loading branch information
ZeroGravitasIndeed authored Apr 21, 2023
2 parents 31700b0 + 415a9bd commit 70f386e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Provisional instructions on how to produce the requisite area data .json files i

___

**v.1.1.2:**
Minor per area-Collections changes:
* Sub-Collections order is now Lights - Terrain - Objects.
* No Terrain Collection if there isn't any terrain object.

**v.1.1.1:**

In order to deal with two kinds of enormous area imports that leave Blender in a super-laggy state, the addon provides with these two new options:
Expand Down
Binary file modified swtor_area_assembler.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions swtor_area_assembler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
bl_info = {
"name": "SWTOR Area Assembler",
"author": "ZeroGravitas & Crunch",
"version": (1, 1,1),
"version": (1, 1, 2),
"blender": (3, 1, 0),
"category": "SWTOR",
"location": "File > Import > SWTOR (Area .json)",
"description": " Allows for the importing of SWTOR .DAT Files converted to .JSON Format",
"description": "Imports Jedipedia.net-exported SWTOR .DAT Files converted to .JSON Format",
"doc_url": "",
"tracker_url": "",
}
Expand Down
46 changes: 24 additions & 22 deletions swtor_area_assembler/area_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,14 @@ def execute(self, context):

filtered_json_location_data = []

has_terrain = False

for element in json_location_data:

if "assetName" in element:
element_filepath = element["assetName"]
if (
(".gr2" in element_filepath or
".hms" in element_filepath or
".lit" in element_filepath or
("dbo" in element_filepath and self.SAAboolSkipDBOObjects == False) )
( ".gr2" in element_filepath or ".hms" in element_filepath or ".lit" in element_filepath or ("dbo" in element_filepath and self.SAAboolSkipDBOObjects == False) )
and not "_fadeportal_" in element_filepath
):

Expand All @@ -211,15 +210,15 @@ def execute(self, context):
if swtor_name_length > max_swtor_name_length:
max_swtor_name_length = swtor_name_length

if ".hms" in element_filepath:
has_terrain = True

filtered_json_location_data.append(element)

# Append this .json data to the master list
swtor_location_data += filtered_json_location_data





# Create Collections.

# Main location collection inside the Scene's root "Scene Collection".
Expand All @@ -229,21 +228,6 @@ def execute(self, context):
else:
location_collection = bpy.data.collections[json_name]

# Location's objects.
if not (json_name + " - Objects") in bpy.data.collections:
location_objects_collection = bpy.data.collections.new(json_name + " - Objects")
location_collection.children.link(location_objects_collection)
else:
location_objects_collection = bpy.data.collections[json_name + " - Objects"]

# Location's terrain.
if not (json_name + " - Terrain") in bpy.data.collections:
location_terrains_collection = bpy.data.collections.new(json_name + " - Terrain")
location_collection.children.link(location_terrains_collection)
else:
location_terrains_collection = bpy.data.collections[json_name + " - Terrain"]


# Location's lights if the user wants them (yes by default)
if self.SAAboolCreateSceneLights == True:
if not (json_name + " - Lights") in bpy.data.collections:
Expand All @@ -252,6 +236,20 @@ def execute(self, context):
else:
location_lights_collection = bpy.data.collections[json_name + " - Lights"]

# Location's terrain.
if has_terrain == True:
if not (json_name + " - Terrain") in bpy.data.collections:
location_terrains_collection = bpy.data.collections.new(json_name + " - Terrain")
location_collection.children.link(location_terrains_collection)
else:
location_terrains_collection = bpy.data.collections[json_name + " - Terrain"]

# Location's objects.
if not (json_name + " - Objects") in bpy.data.collections:
location_objects_collection = bpy.data.collections.new(json_name + " - Objects")
location_collection.children.link(location_objects_collection)
else:
location_objects_collection = bpy.data.collections[json_name + " - Objects"]



Expand All @@ -273,6 +271,10 @@ def execute(self, context):
return {"CANCELLED"}






# -------------------------------------------------------------------------------
# ACTUAL PROCESSING OF THE ELEMENTS IN THE AREA DATA ----------------------------
# -------------------------------------------------------------------------------
Expand Down

0 comments on commit 70f386e

Please sign in to comment.