forked from Fast-64/fast64
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To reduce main __init.py__ bloat
- Loading branch information
Showing
8 changed files
with
212 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from .f3d_material_converter import * | ||
from .f3d import * | ||
from .sm64 import * | ||
from .oot import * # is this really needed? | ||
from .panels import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,131 @@ | ||
from .f3d_parser import * | ||
from .f3d_material import * | ||
from .f3d_render_engine import * | ||
from .f3d_gbi import * | ||
import bpy | ||
from bpy.utils import register_class, unregister_class | ||
|
||
from ... import addon_updater_ops | ||
from ..utility_anim import ArmatureApplyWithMeshOperator | ||
from ..utility import prop_split, multilineLabel | ||
|
||
from .f3d_material import mat_register, mat_unregister | ||
from .f3d_render_engine import render_engine_register, render_engine_unregister | ||
from .f3d_writer import f3d_writer_register, f3d_writer_unregister | ||
from .f3d_parser import f3d_parser_register, f3d_parser_unregister | ||
from .flipbook import flipbook_register, flipbook_unregister | ||
from .op_largetexture import op_largetexture_register, op_largetexture_unregister, ui_oplargetexture | ||
from .bsdf_converter import bsdf_converter_register, bsdf_converter_unregister, bsdf_converter_panel_draw | ||
|
||
|
||
class F3D_GlobalSettingsPanel(bpy.types.Panel): | ||
bl_idname = "F3D_PT_global_settings" | ||
bl_label = "F3D Global Settings" | ||
bl_space_type = "VIEW_3D" | ||
bl_region_type = "UI" | ||
bl_category = "Fast64" | ||
|
||
@classmethod | ||
def poll(cls, context): | ||
return True | ||
|
||
# called every frame | ||
def draw(self, context): | ||
col = self.layout.column() | ||
col.scale_y = 1.1 # extra padding | ||
prop_split(col, context.scene, "f3d_type", "F3D Microcode") | ||
col.prop(context.scene, "saveTextures") | ||
col.prop(context.scene, "f3d_simple", text="Simple Material UI") | ||
col.prop(context.scene, "exportInlineF3D", text="Bleed and Inline Material Exports") | ||
if context.scene.exportInlineF3D: | ||
multilineLabel( | ||
col.box(), | ||
"While inlining, all meshes will be restored to world default values.\n You can configure these values in the world properties tab.", | ||
icon="INFO", | ||
) | ||
col.prop(context.scene, "ignoreTextureRestrictions") | ||
if context.scene.ignoreTextureRestrictions: | ||
col.box().label(text="Width/height must be < 1024. Must be png format.") | ||
|
||
|
||
class Fast64_GlobalToolsPanel(bpy.types.Panel): | ||
bl_idname = "FAST64_PT_global_tools" | ||
bl_label = "Fast64 Tools" | ||
bl_space_type = "VIEW_3D" | ||
bl_region_type = "UI" | ||
bl_category = "Fast64" | ||
|
||
@classmethod | ||
def poll(cls, context): | ||
return True | ||
|
||
# called every frame | ||
def draw(self, context): | ||
# TODO: figure out why a circular import is happening, this is bad | ||
from ..f3d_material_converter import ( | ||
mat_updater_draw, | ||
) | ||
|
||
col = self.layout.column() | ||
col.operator(ArmatureApplyWithMeshOperator.bl_idname) | ||
# col.operator(CreateMetarig.bl_idname) | ||
ui_oplargetexture(col, context) | ||
col.separator() | ||
|
||
box = col.box().column() | ||
box.label(text="Material Updater") | ||
mat_updater_draw(box, context) | ||
col.separator() | ||
|
||
box = col.box().column() | ||
box.label(text="BSDF Converter") | ||
bsdf_converter_panel_draw(box, context) | ||
col.separator() | ||
|
||
addon_updater_ops.update_notice_box_ui(self, context) | ||
|
||
|
||
classes = tuple() | ||
panel_classes = (F3D_GlobalSettingsPanel, Fast64_GlobalToolsPanel) | ||
|
||
|
||
def f3d_panel_register(): | ||
for cls in panel_classes: | ||
register_class(cls) | ||
|
||
|
||
def f3d_panel_unregister(): | ||
for cls in reversed(panel_classes): | ||
unregister_class(cls) | ||
|
||
|
||
def f3d_register(register_panels: bool): | ||
from ..f3d_material_converter import mat_updater_register | ||
|
||
for cls in classes: | ||
register_class(cls) | ||
mat_register() | ||
render_engine_register() | ||
mat_updater_register() | ||
f3d_writer_register() | ||
flipbook_register() | ||
f3d_parser_register() | ||
op_largetexture_register() | ||
bsdf_converter_register() | ||
|
||
if register_panels: | ||
f3d_panel_register() | ||
|
||
|
||
def f3d_unregister(unregister_panels): | ||
from ..f3d_material_converter import mat_updater_unregister | ||
|
||
for cls in reversed(classes): | ||
unregister_class(cls) | ||
bsdf_converter_unregister() | ||
op_largetexture_unregister() | ||
f3d_parser_unregister() | ||
flipbook_unregister() | ||
f3d_writer_unregister() | ||
mat_updater_unregister() | ||
render_engine_unregister() | ||
mat_unregister() | ||
|
||
if unregister_panels: | ||
f3d_panel_unregister() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .operators import bsdf_converter_ops_register, bsdf_converter_ops_unregister | ||
from .ui import bsdf_converter_panel_draw | ||
|
||
|
||
def bsdf_converter_register(): | ||
bsdf_converter_ops_register() | ||
|
||
|
||
def bsdf_converter_unregister(): | ||
bsdf_converter_ops_unregister() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import dataclasses | ||
|
||
|
||
@dataclasses.dataclass | ||
class SimpleN64Texture: | ||
name: str | ||
|
||
|
||
@dataclasses.dataclass | ||
class SimpleN64Material: | ||
name: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from bpy.utils import register_class, unregister_class | ||
|
||
from ...operators import OperatorBase | ||
|
||
|
||
class F3D_ConvertF3DToBSDF(OperatorBase): | ||
bl_idname = "scene.f3d_convert_to_bsdf" | ||
bl_label = "Convert F3D to BSDF" | ||
bl_options = {"REGISTER", "UNDO", "PRESET"} | ||
icon = "MATERIAL" | ||
|
||
|
||
class F3D_ConvertBSDFToF3D(OperatorBase): | ||
bl_idname = "scene.bsdf_convert_to_f3d" | ||
bl_label = "Convert BSDF to F3D" | ||
bl_options = {"REGISTER", "UNDO", "PRESET"} | ||
icon = "NODE_MATERIAL" | ||
|
||
|
||
classes = (F3D_ConvertF3DToBSDF, F3D_ConvertBSDFToF3D) | ||
|
||
|
||
def bsdf_converter_ops_register(): | ||
for cls in classes: | ||
register_class(cls) | ||
|
||
|
||
def bsdf_converter_ops_unregister(): | ||
for cls in reversed(classes): | ||
unregister_class(cls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""Usually this would be panel.py but there is no actual panel since we only draw in the tools panel.""" | ||
|
||
from bpy.types import UILayout, Context | ||
|
||
from .operators import F3D_ConvertF3DToBSDF, F3D_ConvertBSDFToF3D | ||
|
||
|
||
def bsdf_converter_panel_draw(layout: UILayout, _context: Context): | ||
col = layout.column() | ||
F3D_ConvertF3DToBSDF.draw_props(col) | ||
F3D_ConvertBSDFToF3D.draw_props(col) |
Oops, something went wrong.