Objects hidden in viewport will now be exported by default.

This commit is contained in:
kurethedead
2021-02-16 17:53:10 -08:00
parent 2edb1a274e
commit 2cadabb28f
4 changed files with 33 additions and 0 deletions
+3
View File
@@ -229,6 +229,7 @@ class Fast64_GlobalSettingsPanel(bpy.types.Panel):
def draw(self, context):
col = self.layout.column()
prop_split(col, context.scene, 'gameEditorMode', "Game")
col.prop(context.scene, 'exportHiddenGeometry')
col.prop(context.scene, 'fullTraceback')
@@ -291,6 +292,7 @@ def register():
bpy.types.Scene.saveTextures = bpy.props.BoolProperty(
name = 'Save Textures As PNGs (Breaks CI Textures)')
bpy.types.Scene.generateF3DNodeGraph = bpy.props.BoolProperty(name = "Generate F3D Node Graph", default = True)
bpy.types.Scene.exportHiddenGeometry = bpy.props.BoolProperty(name = "Export Hidden Geometry", default = True)
# called on add-on disabling
def unregister():
@@ -308,6 +310,7 @@ def unregister():
del bpy.types.Scene.saveTextures
del bpy.types.Scene.gameEditorMode
del bpy.types.Scene.generateF3DNodeGraph
del bpy.types.Scene.exportHiddenGeometry
for cls in classes:
unregister_class(cls)
+7
View File
@@ -319,10 +319,17 @@ def ootConvertScene(originalSceneObj, transformMatrix,
if originalSceneObj.data is not None or originalSceneObj.ootEmptyType != "Scene":
raise PluginError(originalSceneObj.name + " is not an empty with the \"Scene\" empty type.")
if bpy.context.scene.exportHiddenGeometry:
hiddenObjs = unhideAllAndGetHiddenList(bpy.context.scene)
# Don't remove ignore_render, as we want to resuse this for collision
sceneObj, allObjs = \
ootDuplicateHierarchy(originalSceneObj, None, True, OOTObjectCategorizer())
if bpy.context.scene.exportHiddenGeometry:
hideObjsInList(hiddenObjs)
roomObjs = [child for child in sceneObj.children if child.data is None and child.ootEmptyType == 'Room']
if len(roomObjs) == 0:
raise PluginError("The scene has no child empties with the 'Room' empty type.")
@@ -527,6 +527,10 @@ def exportLevelC(obj, transformMatrix, f3dType, isHWv1, levelName, exportDir,
usesEnvFX = False
echoLevels = ['0x00', '0x00', '0x00']
zoomFlags = [False, False, False, False]
if bpy.context.scene.exportHiddenGeometry:
hiddenObjs = unhideAllAndGetHiddenList(bpy.context.scene)
for child in childAreas:
if len(child.children) == 0:
raise PluginError("Area for " + child.name + " has no children.")
@@ -624,6 +628,9 @@ def exportLevelC(obj, transformMatrix, f3dType, isHWv1, levelName, exportDir,
'_' + backgroundSegments[obj.background] + '_skybox_' + compressionFmt, 'LOAD_' + compressionFmt.upper(), 0x0A)
levelscriptString = prevLevelScript.to_c(areaString)
if bpy.context.scene.exportHiddenGeometry:
hideObjsInList(hiddenObjs)
# Remove old areas.
for f in os.listdir(levelDir):
if re.search('area\_\d+', f):
+16
View File
@@ -36,6 +36,22 @@ enumCompressionFormat = [
('yay0', 'YAY0', 'YAY0'),
]
def unhideAllAndGetHiddenList(scene):
hiddenObjs = []
for obj in scene.objects:
if obj.hide_get():
hiddenObjs.append(obj)
if bpy.context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode = "OBJECT")
bpy.ops.object.hide_view_clear()
return hiddenObjs
def hideObjsInList(hiddenObjs):
for obj in hiddenObjs:
obj.hide_set(True)
def readFile(filepath):
datafile = open(filepath, 'r', newline = '\n', encoding = 'utf-8')
data = datafile.read()