Closed DolphinDream closed 5 years ago
Actually it seems that for scale/location setting values of 2 the easing and texture viewer nodes display the rendering in the proper location. I wonder why the stethoscope node seems to have the weird offset along x for the same scale values (which worked fine in 2.79).
Well, it seems that (for preference settings scale/location of 2) the text location for stethoscope is fine if the node is expanded.. the issue seems to be with the node when it’s minimized. I wonder if the node width is not reported correctly when the node is minimized, hence the wrong offset.
this also bugs me.
i don't think there's an update triggered by blender, that sverchok can interpret/receive to say "hey this node is minimized". Hence, if the node is drawing to nodeview already and the user minimizes using some built in operator, there wouldn't be a last signal to the stethoscope to redraw.
i'll look at it again. also the need to manually set the scale/whatever is not ideal and worth seeing maybe how AN acquires the info. (if i had such hardware i would figure it out myself)
let me rename the title of this issue to reflect something we don't address yet, the location of minimized nodes vs their nodeview draw location
this is what we do in stethoscope b28
scale, location_theta = self.get_preferences()
....
# adjust proposed text location in case node is framed.
# take into consideration the hidden state
node_width = (self.width_hidden + 30.0) if self.hide else self.width
_x, _y = recursive_framed_location_finder(self, self.location[:])
_x, _y = Vector((_x, _y)) + Vector((node_width + 20, 0))
# this alters location based on DPI/Scale settings.
location = adjust_location(_x, _y, location_theta)
and in texture viewer, unceremoniously
def adjust_position_and_dimensions(self, x, y, width, height):
"""
this could also return scale for a blf notation in the vacinity of the texture
"""
scale, multiplier = self.get_preferences()
x, y = [x * multiplier, y * multiplier]
width, height = [width * scale, height * scale]
return x, y, width, height
...
x, y, width, height = self.adjust_position_and_dimensions(x, y, width, height)
just tested dropping width_hidden usage in stethoscope, works as hoped. pushed. will close this issue
https://github.com/nortikin/sverchok/pull/2299/commits/3f3d4661c9116ac04633c4b0ff302750fbc5ed6c
i'll dig through the AN source to see how scale
and multiplier
can be inferred automatically
in AN they do
def getDpiFactor():
return getDpi() / 72
def getDpi():
systemPreferences = bpy.context.user_preferences.system
retinaFactor = getattr(systemPreferences, "pixel_size", 1)
return systemPreferences.dpi * retinaFactor
because updating these values isn't continously needed, we might offer a button in the N-Panel to update nodeview drawing parameters when pressed. The operator would then adjust the sverchok preferences. While the XY location of drawing should not be useful to manually set (assuming it is correctly introspected) the Scale of the nodeview drawing is a separate matter - some user driven customization might be desirable (ie wanting to see the stethoscope output slightly larger.. for one stethoscope.. but not all )
in Blender 2.8 user_preferences
was renamed..
import bpy
def getDpiFactor():
return getDpi() / 72
def getDpi():
systemPreferences = bpy.context.preferences.system
retinaFactor = getattr(systemPreferences, "pixel_size", 1)
return systemPreferences.dpi * retinaFactor
print('dpi factor', getDpiFactor())
print('dpi', getDpi())
>>> dpi factor 1.0
>>> dpi 72.0
so.. logically, if the scale and multiplier must be manually set to 2 for hires screens (in Sverchok prefs)
then maybe you guys are getting
dpi factor 2.0
dpi 144.0
so.. logically, if the scale and multiplier must be manually set to 2 for hires screens (in Sverchok prefs)
then maybe you guys are getting
dpi factor 2.0 dpi 144.0
yep. that’s what i get..
print('dpi factor', getDpiFactor()) dpi factor 2.0
print('dpi', getDpi()) dpi 144.0
OK, well that's solved then. about 3 years late :)
Similar to a previous issue in 2.79, the Stethoscope seems to still have issues with rendering its display (on mac osx Mojave 10.14.6). Adjusting sverchok preference settings for render scale and location values doesn’t seem to fix the problem. In 2.79 it used to be that a scale/location values of 2 fixed the problem but in 2.80 a value of 2 for these scale/location settings does not fix the problem. I can’t figure out if for 2.80 there are some magical set of values for these settings that would place the text in the right location relative to the stethoscope nodes.
I suspect that if this node has this rendering issues perhaps other nodes that do GL rendering in the node editor window would probably have similar displacement issues.
Personally, for noding and for developing nodes I find it essential to have this rendered text be properly displayed relative to the stethoscope node otherwise it becomes hard to debug a node setup.