Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5537 from BigRoy/enhancement/tweak_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
antirotor authored Sep 6, 2023
2 parents 83f4c2e + d36b2f1 commit 42936e9
Show file tree
Hide file tree
Showing 97 changed files with 391 additions and 359 deletions.
2 changes: 1 addition & 1 deletion openpype/hosts/fusion/plugins/publish/collect_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ def process(self, instance):
# Add review family if the instance is marked as 'review'
# This could be done through a 'review' Creator attribute.
if instance.data.get("review", False):
self.log.info("Adding review family..")
self.log.debug("Adding review family..")
instance.data["families"].append("review")
3 changes: 0 additions & 3 deletions openpype/hosts/maya/plugins/publish/collect_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ def process(self, instance):
# Get all content from the instance
instance_lookup = set(cmds.ls(instance, type="transform", long=True))
data = defaultdict(list)
self.log.info(instance_lookup)

hierarchy_nodes = []
for container in containers:

self.log.info(container)
root = lib.get_container_transforms(container, root=True)
self.log.info(root)
if not root or root not in instance_lookup:
continue

Expand Down
1 change: 0 additions & 1 deletion openpype/hosts/maya/plugins/publish/collect_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class CollectMayaHistory(pyblish.api.InstancePlugin):
hosts = ["maya"]
label = "Maya History"
families = ["rig"]
verbose = False

def process(self, instance):

Expand Down
4 changes: 3 additions & 1 deletion openpype/hosts/maya/plugins/publish/collect_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class CollectNewInstances(pyblish.api.InstancePlugin):
order = pyblish.api.CollectorOrder
hosts = ["maya"]

valid_empty_families = {"workfile", "renderlayer"}

def process(self, instance):

objset = instance.data.get("instance_node")
Expand Down Expand Up @@ -58,7 +60,7 @@ def process(self, instance):

instance[:] = members_hierarchy

elif instance.data["family"] != "workfile":
elif instance.data["family"] not in self.valid_empty_families:
self.log.warning("Empty instance: \"%s\" " % objset)
# Store the exact members of the object set
instance.data["setMembers"] = members
Expand Down
31 changes: 16 additions & 15 deletions openpype/hosts/maya/plugins/publish/collect_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,9 @@ def collect(self, instance):
# Thus the data will be limited to only what we need.
self.log.debug("obj_set {}".format(sets[obj_set]))
if not sets[obj_set]["members"]:
self.log.info(
"Removing redundant set information: {}".format(obj_set))
self.log.debug(
"Removing redundant set information: {}".format(obj_set)
)
sets.pop(obj_set, None)

self.log.debug("Gathering attribute changes to instance members..")
Expand Down Expand Up @@ -396,9 +397,9 @@ def collect(self, instance):
if con:
materials.extend(con)

self.log.info("Found materials:\n{}".format(materials))
self.log.debug("Found materials:\n{}".format(materials))

self.log.info("Found the following sets:\n{}".format(look_sets))
self.log.debug("Found the following sets:\n{}".format(look_sets))
# Get the entire node chain of the look sets
# history = cmds.listHistory(look_sets)
history = []
Expand Down Expand Up @@ -456,7 +457,7 @@ def collect(self, instance):
instance.extend(shader for shader in look_sets if shader
not in instance_lookup)

self.log.info("Collected look for %s" % instance)
self.log.debug("Collected look for %s" % instance)

def collect_sets(self, instance):
"""Collect all objectSets which are of importance for publishing
Expand Down Expand Up @@ -593,7 +594,7 @@ def collect_resources(self, node):
if attribute == "fileTextureName":
computed_attribute = node + ".computedFileTextureNamePattern"

self.log.info(" - file source: {}".format(source))
self.log.debug(" - file source: {}".format(source))
color_space_attr = "{}.colorSpace".format(node)
try:
color_space = cmds.getAttr(color_space_attr)
Expand Down Expand Up @@ -621,7 +622,7 @@ def collect_resources(self, node):
dependNode=True)
)
if not source and cmds.nodeType(node) in pxr_nodes:
self.log.info("Renderman: source is empty, skipping...")
self.log.debug("Renderman: source is empty, skipping...")
continue
# We replace backslashes with forward slashes because V-Ray
# can't handle the UDIM files with the backslashes in the
Expand All @@ -630,14 +631,14 @@ def collect_resources(self, node):

files = get_file_node_files(node)
if len(files) == 0:
self.log.error("No valid files found from node `%s`" % node)

self.log.info("collection of resource done:")
self.log.info(" - node: {}".format(node))
self.log.info(" - attribute: {}".format(attribute))
self.log.info(" - source: {}".format(source))
self.log.info(" - file: {}".format(files))
self.log.info(" - color space: {}".format(color_space))
self.log.debug("No valid files found from node `%s`" % node)

self.log.debug("collection of resource done:")
self.log.debug(" - node: {}".format(node))
self.log.debug(" - attribute: {}".format(attribute))
self.log.debug(" - source: {}".format(source))
self.log.debug(" - file: {}".format(files))
self.log.debug(" - color space: {}".format(color_space))

# Define the resource
yield {
Expand Down
20 changes: 10 additions & 10 deletions openpype/hosts/maya/plugins/publish/collect_multiverse_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def process(self, instance):
cmds.loadPlugin("MultiverseForMaya", quiet=True)
import multiverse

self.log.info("Processing mvLook for '{}'".format(instance))
self.log.debug("Processing mvLook for '{}'".format(instance))

nodes = set()
for node in instance:
Expand All @@ -287,7 +287,7 @@ def process(self, instance):
publishMipMap = instance.data["publishMipMap"]

for node in nodes:
self.log.info("Getting resources for '{}'".format(node))
self.log.debug("Getting resources for '{}'".format(node))

# We know what nodes need to be collected, now we need to
# extract the materials overrides.
Expand Down Expand Up @@ -380,12 +380,12 @@ def collect_resource(self, node, publishMipMap):
if len(files) == 0:
self.log.error("No valid files found from node `%s`" % node)

self.log.info("collection of resource done:")
self.log.info(" - node: {}".format(node))
self.log.info(" - attribute: {}".format(fname_attrib))
self.log.info(" - source: {}".format(source))
self.log.info(" - file: {}".format(files))
self.log.info(" - color space: {}".format(color_space))
self.log.debug("collection of resource done:")
self.log.debug(" - node: {}".format(node))
self.log.debug(" - attribute: {}".format(fname_attrib))
self.log.debug(" - source: {}".format(source))
self.log.debug(" - file: {}".format(files))
self.log.debug(" - color space: {}".format(color_space))

# Define the resource
resource = {"node": node,
Expand All @@ -406,14 +406,14 @@ def handle_files(self, files, publishMipMap):
extra_files = []
self.log.debug("Expecting MipMaps, going to look for them.")
for fname in files:
self.log.info("Checking '{}' for mipmaps".format(fname))
self.log.debug("Checking '{}' for mipmaps".format(fname))
if is_mipmap(fname):
self.log.debug(" - file is already MipMap, skipping.")
continue

mipmap = get_mipmap(fname)
if mipmap:
self.log.info(" mipmap found for '{}'".format(fname))
self.log.debug(" mipmap found for '{}'".format(fname))
extra_files.append(mipmap)
else:
self.log.warning(" no mipmap found for '{}'".format(fname))
Expand Down
12 changes: 6 additions & 6 deletions openpype/hosts/maya/plugins/publish/collect_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def process(self, instance):
"family": cmds.getAttr("{}.family".format(s)),
}
)
self.log.info(" -> attach render to: {}".format(s))
self.log.debug(" -> attach render to: {}".format(s))

layer_name = layer.name()

Expand Down Expand Up @@ -137,10 +137,10 @@ def process(self, instance):
has_cameras = any(product.camera for product in render_products)
assert has_cameras, "No render cameras found."

self.log.info("multipart: {}".format(
self.log.debug("multipart: {}".format(
multipart))
assert expected_files, "no file names were generated, this is a bug"
self.log.info(
self.log.debug(
"expected files: {}".format(
json.dumps(expected_files, indent=4, sort_keys=True)
)
Expand Down Expand Up @@ -175,7 +175,7 @@ def process(self, instance):
publish_meta_path = os.path.dirname(full_path)
aov_dict[aov_first_key] = full_paths
full_exp_files = [aov_dict]
self.log.info(full_exp_files)
self.log.debug(full_exp_files)

if publish_meta_path is None:
raise KnownPublishError("Unable to detect any expected output "
Expand Down Expand Up @@ -227,7 +227,7 @@ def process(self, instance):
if platform.system().lower() in ["linux", "darwin"]:
common_publish_meta_path = "/" + common_publish_meta_path

self.log.info(
self.log.debug(
"Publish meta path: {}".format(common_publish_meta_path))

# Get layer specific settings, might be overrides
Expand Down Expand Up @@ -300,7 +300,7 @@ def process(self, instance):
)
if rr_settings["enabled"]:
data["rrPathName"] = instance.data.get("rrPathName")
self.log.info(data["rrPathName"])
self.log.debug(data["rrPathName"])

if self.sync_workfile_version:
data["version"] = context.data["version"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def process(self, instance):

# Get renderer
renderer = instance.data["renderer"]
self.log.info("Renderer found: {}".format(renderer))
self.log.debug("Renderer found: {}".format(renderer))

rp_node_types = {"vray": ["VRayRenderElement", "VRayRenderElementSet"],
"arnold": ["aiAOV"],
Expand Down Expand Up @@ -66,8 +66,8 @@ def process(self, instance):

result.append(render_pass)

self.log.info("Found {} render elements / AOVs for "
"'{}'".format(len(result), instance.data["subset"]))
self.log.debug("Found {} render elements / AOVs for "
"'{}'".format(len(result), instance.data["subset"]))

instance.data["renderPasses"] = result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ def process(self, instance):
else:
layer = instance.data["renderlayer"]

self.log.info("layer: {}".format(layer))
cameras = cmds.ls(type="camera", long=True)
renderable = [c for c in cameras if
get_attr_in_layer("%s.renderable" % c, layer)]
renderable = [cam for cam in cameras if
get_attr_in_layer("{}.renderable".format(cam), layer)]

self.log.info("Found cameras %s: %s" % (len(renderable), renderable))
self.log.debug(
"Found renderable cameras %s: %s", len(renderable), renderable
)

instance.data["cameras"] = renderable
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def process(self, instance):
instance.data["geometryMembers"] = cmds.sets(
geometry_set, query=True)

self.log.info("geometry: {}".format(
self.log.debug("geometry: {}".format(
pformat(instance.data.get("geometryMembers"))))

collision_set = [
Expand All @@ -29,7 +29,7 @@ def process(self, instance):
instance.data["collisionMembers"] = cmds.sets(
collision_set, query=True)

self.log.info("collisions: {}".format(
self.log.debug("collisions: {}".format(
pformat(instance.data.get("collisionMembers"))))

frame = cmds.currentTime(query=True)
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/maya/plugins/publish/collect_xgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ def process(self, instance):

data["transfers"] = transfers

self.log.info(data)
self.log.debug(data)
instance.data.update(data)
5 changes: 2 additions & 3 deletions openpype/hosts/maya/plugins/publish/collect_yeti_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def get_yeti_resources(self, node):
texture_filenames = []
if image_search_paths:


# TODO: Somehow this uses OS environment path separator, `:` vs `;`
# Later on check whether this is pipeline OS cross-compatible.
image_search_paths = [p for p in
Expand All @@ -130,13 +129,13 @@ def get_yeti_resources(self, node):

# List all related textures
texture_filenames = cmds.pgYetiCommand(node, listTextures=True)
self.log.info("Found %i texture(s)" % len(texture_filenames))
self.log.debug("Found %i texture(s)" % len(texture_filenames))

# Get all reference nodes
reference_nodes = cmds.pgYetiGraph(node,
listNodes=True,
type="reference")
self.log.info("Found %i reference node(s)" % len(reference_nodes))
self.log.debug("Found %i reference node(s)" % len(reference_nodes))

if texture_filenames and not image_search_paths:
raise ValueError("pgYetiMaya node '%s' is missing the path to the "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def process(self, instance):

instance.data["representations"].append(representation)

self.log.info(
self.log.debug(
"Extracted instance {} to: {}".format(instance.name, staging_dir)
)

Expand All @@ -126,7 +126,7 @@ def process(self, instance):
instance.data["representations"].append(representation)

def _extract(self, nodes, attribute_data, kwargs):
self.log.info(
self.log.debug(
"Writing {} with:\n{}".format(kwargs["filename"], kwargs)
)
filenames = []
Expand Down Expand Up @@ -180,12 +180,12 @@ def _extract(self, nodes, attribute_data, kwargs):

with lib.attribute_values(attribute_data):
with lib.maintained_selection():
self.log.info(
self.log.debug(
"Writing: {}".format(duplicate_nodes)
)
cmds.select(duplicate_nodes, noExpand=True)

self.log.info(
self.log.debug(
"Extracting ass sequence with: {}".format(kwargs)
)

Expand All @@ -194,6 +194,6 @@ def _extract(self, nodes, attribute_data, kwargs):
for file in exported_files:
filenames.append(os.path.split(file)[1])

self.log.info("Exported: {}".format(filenames))
self.log.debug("Exported: {}".format(filenames))

return filenames, nodes_by_id
2 changes: 1 addition & 1 deletion openpype/hosts/maya/plugins/publish/extract_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def process(self, instance):
json_filename = "{}.json".format(instance.name)
json_path = os.path.join(staging_dir, json_filename)

self.log.info("Dumping scene data for debugging ..")
self.log.debug("Dumping scene data for debugging ..")
with open(json_path, "w") as filepath:
json.dump(instance.data["scenedata"], filepath, ensure_ascii=False)

Expand Down
4 changes: 2 additions & 2 deletions openpype/hosts/maya/plugins/publish/extract_camera_alembic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def process(self, instance):
"Attributes to bake must be specified as a list"
)
for attr in self.bake_attributes:
self.log.info("Adding {} attribute".format(attr))
self.log.debug("Adding {} attribute".format(attr))
job_str += " -attr {0}".format(attr)

with lib.evaluation("off"):
Expand All @@ -112,5 +112,5 @@ def process(self, instance):
}
instance.data["representations"].append(representation)

self.log.info("Extracted instance '{0}' to: {1}".format(
self.log.debug("Extracted instance '{0}' to: {1}".format(
instance.name, path))
Loading

0 comments on commit 42936e9

Please sign in to comment.