Skip to content

Commit

Permalink
Merge pull request #3742 from ferdnyc/properties-debug
Browse files Browse the repository at this point in the history
Properties model: Make most logs debug
  • Loading branch information
jonoomph authored Oct 16, 2020
2 parents 47c7e2b + c2c737d commit 2121020
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions src/windows/models/properties_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def changed(self, action):

# Handle change
if action.key and action.key[0] in ["clips", "effects"] and action.type in ["update", "insert"]:
log.info(action.values)
log.debug(action.values)
# Update the model data
self.update_model(get_app().window.txtPropertyFilter.text())

Expand All @@ -88,7 +88,7 @@ def update_item_timeout(self):
self.selected = []
self.filter_base_properties = []

log.info("Update item: %s" % item_type)
log.debug("Update item: %s" % item_type)

if item_type == "clip":
c = get_app().window.timeline_sync.timeline.GetClip(item_id)
Expand Down Expand Up @@ -200,7 +200,7 @@ def remove_keyframe(self, item):
c = Effect.get(id=clip_id)

if c and property_key in c.data: # Update clip attribute
log.info("remove keyframe: %s" % c.data)
log.debug("remove keyframe: %s" % c.data)

# Determine type of keyframe (normal or color)
keyframe_list = []
Expand Down Expand Up @@ -232,7 +232,7 @@ def remove_keyframe(self, item):
# Delete point (if needed)
if point_to_delete:
clip_updated = True
log.info("Found point to delete at X=%s" % point_to_delete["co"]["X"])
log.debug("Found point to delete at X=%s" % point_to_delete["co"]["X"])
keyframe["Points"].remove(point_to_delete)

# Reduce # of clip properties we are saving (performance boost)
Expand Down Expand Up @@ -278,7 +278,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
if c:
# Update clip attribute
if property_key in c.data:
log.info("color update: %s" % c.data)
log.debug("color update: %s" % c.data)

# Loop through each keyframe (red, blue, and green)
for color, new_value in [("red", new_color.red()), ("blue", new_color.blue()), ("green", new_color.green())]:
Expand All @@ -287,14 +287,14 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
# Loop through points, find a matching points on this frame
found_point = False
for point in c.data[property_key][color]["Points"]:
log.info("looping points: co.X = %s" % point["co"]["X"])
log.debug("looping points: co.X = %s" % point["co"]["X"])
if interpolation == -1 and point["co"]["X"] == self.frame_number:
# Found point, Update value
found_point = True
clip_updated = True
# Update point
point["co"]["Y"] = new_value
log.info("updating point: co.X = %s to value: %s" % (point["co"]["X"], float(new_value)))
log.debug("updating point: co.X = %s to value: %s" % (point["co"]["X"], float(new_value)))
break

elif interpolation > -1 and point["co"]["X"] == previous_point_x:
Expand All @@ -307,8 +307,8 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
point["handle_right"]["X"] = interpolation_details[0]
point["handle_right"]["Y"] = interpolation_details[1]

log.info("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.info("use interpolation preset: %s" % str(interpolation_details))
log.debug("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.debug("use interpolation preset: %s" % str(interpolation_details))

elif interpolation > -1 and point["co"]["X"] == closest_point_x:
# Only update interpolation type (and the RIGHT side of the curve)
Expand All @@ -320,13 +320,13 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
point["handle_left"]["X"] = interpolation_details[2]
point["handle_left"]["Y"] = interpolation_details[3]

log.info("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.info("use interpolation preset: %s" % str(interpolation_details))
log.debug("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.debug("use interpolation preset: %s" % str(interpolation_details))

# Create new point (if needed)
if not found_point:
clip_updated = True
log.info("Created new point at X=%s" % self.frame_number)
log.debug("Created new point at X=%s" % self.frame_number)
c.data[property_key][color]["Points"].append({'co': {'X': self.frame_number, 'Y': new_value}, 'interpolation': 1})

# Reduce # of clip properties we are saving (performance boost)
Expand Down Expand Up @@ -385,7 +385,7 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
else:
new_value = None

log.info("%s for %s changed to %s at frame %s with interpolation: %s at closest x: %s" % (property_key, clip_id, new_value, self.frame_number, interpolation, closest_point_x))
log.debug("Changing value for %s in clip %s to %s at frame %s with interpolation: %s at closest x: %s" % (property_key, clip_id, new_value, self.frame_number, interpolation, closest_point_x))


# Find this clip
Expand All @@ -405,7 +405,7 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
if c:
# Update clip attribute
if property_key in c.data:
log.info("value updated: %s" % c.data)
log.debug("value updated: %s" % c.data)

# Check the type of property (some are keyframe, and some are not)
if property_type != "reader" and type(c.data[property_key]) == dict:
Expand All @@ -414,15 +414,15 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
found_point = False
point_to_delete = None
for point in c.data[property_key]["Points"]:
log.info("looping points: co.X = %s" % point["co"]["X"])
log.debug("looping points: co.X = %s" % point["co"]["X"])
if interpolation == -1 and point["co"]["X"] == self.frame_number:
# Found point, Update value
found_point = True
clip_updated = True
# Update or delete point
if new_value != None:
point["co"]["Y"] = float(new_value)
log.info("updating point: co.X = %s to value: %s" % (point["co"]["X"], float(new_value)))
log.debug("updating point: co.X = %s to value: %s" % (point["co"]["X"], float(new_value)))
else:
point_to_delete = point
break
Expand All @@ -437,8 +437,8 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
point["handle_right"]["X"] = interpolation_details[0]
point["handle_right"]["Y"] = interpolation_details[1]

log.info("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.info("use interpolation preset: %s" % str(interpolation_details))
log.debug("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.debug("use interpolation preset: %s" % str(interpolation_details))

elif interpolation > -1 and point["co"]["X"] == closest_point_x:
# Only update interpolation type (and the RIGHT side of the curve)
Expand All @@ -450,19 +450,19 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
point["handle_left"]["X"] = interpolation_details[2]
point["handle_left"]["Y"] = interpolation_details[3]

log.info("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.info("use interpolation preset: %s" % str(interpolation_details))
log.debug("updating interpolation mode point: co.X = %s to %s" % (point["co"]["X"], interpolation))
log.debug("use interpolation preset: %s" % str(interpolation_details))

# Delete point (if needed)
if point_to_delete:
clip_updated = True
log.info("Found point to delete at X=%s" % point_to_delete["co"]["X"])
log.debug("Found point to delete at X=%s" % point_to_delete["co"]["X"])
c.data[property_key]["Points"].remove(point_to_delete)

# Create new point (if needed)
elif not found_point and new_value != None:
clip_updated = True
log.info("Created new point at X=%s" % self.frame_number)
log.debug("Created new point at X=%s" % self.frame_number)
c.data[property_key]["Points"].append({'co': {'X': self.frame_number, 'Y': new_value}, 'interpolation': 1})

if not clip_updated:
Expand Down Expand Up @@ -518,11 +518,13 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
# Update the preview
get_app().window.refreshFrameSignal.emit()

log.info("Item %s: changed %s to %s at frame %s (x: %s)" % (clip_id, property_key, new_value, self.frame_number, closest_point_x))

# Clear selection
self.parent.clearSelection()

def update_model(self, filter=""):
log.info("updating clip properties model.")
log.debug("updating clip properties model.")
app = get_app()
_ = app._tr

Expand Down

0 comments on commit 2121020

Please sign in to comment.