PDT: Merge branch 'blender-v2.82-release'

This commit is contained in:
Rune Morling 2020-02-05 12:29:27 +01:00
commit 3918da32ba
2 changed files with 16 additions and 5 deletions

View File

@ -26,7 +26,7 @@ from bpy.types import Operator
from mathutils import Vector
from pathlib import Path
from .pdt_functions import debug, oops
from .pdt_msg_strings import PDT_ERR_NO_LIBRARY
from .pdt_msg_strings import PDT_ERR_NO_LIBRARY, PDT_ERR_OBJECTMODE
class PDT_OT_LibShow(Operator):
@ -81,14 +81,19 @@ class PDT_OT_Append(Operator):
scene = context.scene
pg = scene.pdt_pg
obj = context.view_layer.objects.active
if obj is not None:
if obj.mode != "OBJECT":
error_message = PDT_ERR_OBJECTMODE
self.report({"ERROR"}, error_message)
return {"FINISHED"}
obj_names = [o.name for o in context.view_layer.objects].copy()
file_path = context.preferences.addons[__package__].preferences.pdt_library_path
path = Path(file_path)
if path.is_file() and ".blend" in str(path):
if pg.lib_mode == "OBJECTS":
# Force object Mode
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.wm.append(
filepath=str(path),
directory=str(path) + "/Object",
@ -158,12 +163,17 @@ class PDT_OT_Link(Operator):
scene = context.scene
pg = scene.pdt_pg
obj = context.view_layer.objects.active
if obj is not None:
if obj.mode != "OBJECT":
error_message = PDT_ERR_OBJECTMODE
self.report({"ERROR"}, error_message)
return {"FINISHED"}
file_path = context.preferences.addons[__package__].preferences.pdt_library_path
path = Path(file_path)
if path.is_file() and ".blend" in str(path):
if pg.lib_mode == "OBJECTS":
# Force object Mode
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.wm.link(
filepath=str(path),
directory=str(path) + "/Object",

View File

@ -84,6 +84,7 @@ PDT_LAB_PIVOTLOCH = "Location"
# Error Message
#
PDT_ERR_NO_ACT_OBJ = "No Active Object - Please Select an Object"
PDT_ERR_OBJECTMODE = "Library Append/Link Tools Work Only in Object Mode"
PDT_OBJ_MODE_ERROR = "Only Mesh Object in Edit or Object Mode Supported"
PDT_ERR_NO_ACT_VERT = "No Active Vertex - Select One Vertex Individually"
PDT_ERR_NO_SEL_GEOM = "No Geometry/Objects Selected"