Skip to content

Commit

Permalink
Remove export_plane code
Browse files Browse the repository at this point in the history
  • Loading branch information
oRazeD committed Jan 8, 2025
1 parent 2e15ca7 commit c081cb5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 62 deletions.
3 changes: 1 addition & 2 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Global:
'OPEN_EXR': 'exr',
'PNG': 'png'}

NODE_GROUP_WARN = \
"""
NODE_GROUP_WARN = """
This node is generated by GrabDoc! Once exiting Map Preview,
every node link will be returned to their original sockets.
Expand Down
11 changes: 3 additions & 8 deletions operators/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

from ..constants import Global, Error
from ..ui import register_baker_panels
from ..utils.io import get_format, get_temp_path
from ..utils.render import get_rendered_objects
from ..utils.generic import get_user_preferences
from ..utils.node import link_group_to_object, node_cleanup
from ..utils.io import export_plane, get_format, get_temp_path
from ..utils.scene import (
camera_in_3d_view, is_scene_valid, scene_setup, scene_cleanup, validate_scene
camera_in_3d_view, is_scene_valid,
scene_setup, scene_cleanup, validate_scene
)
from ..utils.baker import (
get_baker_collections, import_baker_textures, baker_setup,
Expand Down Expand Up @@ -257,9 +258,6 @@ def execute(self, context: Context):
plane_ob = bpy.data.objects[Global.BG_PLANE_NAME]
plane_ob.scale[0] = plane_ob.scale[1] = 1

if gd.export_plane:
export_plane(context)

if active_selected:
context.view_layer.objects.active = bpy.data.objects[activeCallback]
if bpy.ops.object.mode_set.poll():
Expand Down Expand Up @@ -578,9 +576,6 @@ def execute(self, context: Context):
if scale_plane:
plane_ob.scale[0] = plane_ob.scale[1] = 1

if gd.export_plane:
export_plane(context)

elapsed = round(time.time() - start, 2)
self.report(
{'INFO'}, f"{Error.EXPORT_COMPLETE} (execution time: {elapsed}s)"
Expand Down
5 changes: 1 addition & 4 deletions operators/marmoset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import bpy
from bpy.types import Context, Operator, Object
from ..utils.io import export_plane, get_temp_path
from ..utils.io import get_temp_path

from ..constants import Global, Error
from ..utils.generic import get_user_preferences
Expand Down Expand Up @@ -84,9 +84,6 @@ def open_marmoset(self, context: Context, temp_path, addon_path):
with open(json_path, "w", encoding='utf-8') as file:
file.write(json_properties)

if gd.export_plane:
export_plane(context)

args = [
executable,
os.path.join(addon_path, "utils", "marmoset.py")
Expand Down
19 changes: 2 additions & 17 deletions preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ def update_res_y(self, context: Context):
def update_scale(self, context: Context):
scene_setup(self, context)

# TODO: Validate necessity
#height = bpy.data.node_groups.get(Height.node_name)
#map_range = height.nodes.get('Map Range')
#camera_object_z = Global.CAMERA_DISTANCE * bpy.context.scene.gd.scale
#map_range.inputs[1].default_value = \
# camera_object_z - self.height[0].distance
#map_range.inputs[2].default_value = camera_object_z
#alpha = bpy.data.node_groups.get(Alpha.node_name)
#map_range_alpha = alpha.nodes.get('Map Range')
#map_range_alpha.inputs[1].default_value = camera_object_z - .00001
#map_range_alpha.inputs[2].default_value = camera_object_z

# Scene
coll_selectable: BoolProperty(
description="Sets the background plane selection capability",
Expand Down Expand Up @@ -172,9 +160,6 @@ def update_scale(self, context: Context):
description="Add a collection to the scene for use as bake groups",
update=scene_setup
)
export_plane: BoolProperty(
description="Export the background plane as an unwrapped FBX"
)

# Bake maps
MAP_TYPES = [('none', "None", "")]
Expand Down Expand Up @@ -287,9 +272,9 @@ def register():
bpy.utils.register_class(cls)

Scene.gd = PointerProperty(type=GRABDOC_PG_properties)
Collection.gd_collection = BoolProperty()
Object.gd_object = BoolProperty()
Node.gd_spawn = BoolProperty()
Object.gd_object = BoolProperty()
Collection.gd_collection = BoolProperty()

def unregister():
for cls in classes:
Expand Down
1 change: 0 additions & 1 deletion ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def draw(self, context: Context):

col = layout.column(align=True)
col.prop(gd, "use_bake_collection", text="Bake Groups")
col.prop(gd, "export_plane", text='Export Plane')
col.prop(gd, 'use_pack_maps')
if gd.use_pack_maps:
col.prop(gd, 'remove_original_maps')
Expand Down
30 changes: 0 additions & 30 deletions utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,6 @@
from ..constants import Global


def export_plane(context: Context) -> None:
"""Export the grabdoc background plane for external use"""
gd = context.scene.gd

# Save original selection
savedSelection = context.selected_objects

# Deselect all objects
bpy.ops.object.select_all(action='DESELECT')

# Select bg plane, export and deselect bg plane
bpy.data.collections[Global.COLL_CORE_NAME].hide_select = False
bpy.data.objects[Global.BG_PLANE_NAME].hide_select = False
bpy.data.objects[Global.BG_PLANE_NAME].select_set(True)

bpy.ops.export_scene.fbx(
filepath=os.path.join(gd.filepath, gd.filename + '_plane.fbx'),
use_selection=True
)

bpy.data.objects[Global.BG_PLANE_NAME].select_set(False)

# Refresh original selection
for ob in savedSelection:
ob.select_set(True)

if not gd.coll_selectable:
bpy.data.collections[Global.COLL_CORE_NAME].hide_select = False


def get_temp_path() -> str:
"""Gets or creates a temporary directory based on the extensions system."""
return bpy.utils.extension_path_user(
Expand Down

0 comments on commit c081cb5

Please sign in to comment.