nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.23k stars 232 forks source link

[Backburner] viewer layers node issues. #3145

Open zeffii opened 4 years ago

zeffii commented 4 years ago

we will get to this issue once issues with existing nodes are not as profound.

portnov commented 4 years ago

which issues? :)

zeffii commented 4 years ago

console printout here: https://github.com/nortikin/sverchok/pull/3089#issuecomment-621717912

sv: import settings
sv: import all modules
sv: append app.handlers
sv: enable internal debug logging.
2020-04-30 13:20:12,177 [INFO] sverchok.utils.logging: log level, 20
Exception in module register(): C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\__init__.py
Traceback (most recent call last):
  File "C:\Users\zeffi\Desktop\test_blenders\current_28\2.83\scripts\modules\addon_utils.py", line 382, in enable
    mod.register()
  File "C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\__init__.py", line 86, in register
    sv_registration_utils.register_all(imported_modules + node_list)
  File "C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\core\__init__.py", line 24, in sv_register_modules
    m.register()
  File "C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\nodes\scene\viewer_layer.py", line 493, in register
    subscribe_to_viewer_nodes_name_changes()
  File "C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\nodes\scene\viewer_layer.py", line 75, in subscribe_to_viewer_nodes_name_changes
    subscribe_to_changes(subscribe_to, "Viewer node name changed", viewer_name_change_callback)
  File "C:\Users\zeffi\Desktop\scripts\addons_contrib\sverchok\core\handlers.py", line 35, in subscribe_to_changes
    options={"PERSISTENT", }
RuntimeError: subscribe_rna, missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

locally i was merging the viewerlayer node into my prop_search_use_pointerproperty branch,, and that stopped working until i reset hard to

$ git reset --hard c8595a7
$ git reset --soft HEAD@{1}
$ git commit -m "revert to c8595a7"

maybe renaming the persistent handler introduced issues for .blends that are saved with the old handler name. I have a startup.blend that has a default SV NodeTree .

zeffii commented 4 years ago

I imagine the die hard Sverchok heads all have a startup.blend with a NodeTree ready to rok.

zeffii commented 4 years ago

maybe subscribe_to_viewer_nodes_name_changes() should be done not in the viewer_layer node register function, but instead after all nodes are loaded.

vicdoval commented 4 years ago

confirmed, master is broken RuntimeError: subscribe_rna, missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

zeffii commented 4 years ago

subscribe_to_viewer_nodes_name_changes() should not happen in that node's register.

zeffii commented 4 years ago

over the last couple of months we've seen reports from people on different operating systems that seem to suggest that the order in which python registers objects differs across implementations. Maybe i'm missing something here, but subscribe_to_viewer_nodes_name_changes() should probably be called after it knows for sure that those two nodes are indeed registered.

zeffii commented 4 years ago

i'd like to branch the current master as master_developement, then revert current master Head to the last working version, and we fix stuff in master_development branch..

zeffii commented 4 years ago

done https://github.com/nortikin/sverchok/pull/3147 master_development is now where you fix this beast. it might be super simple, but it needs to work on all machines.

zeffii commented 4 years ago

what bothers me here is that travis did not catch this either.

DolphinDream commented 4 years ago

Anybody working on fixing this? Should I be the one updating the VLN to get it to work? the problem is I cant get to replicate this on my system, so I’m not sure if I would fix anything if i tried :)

As I mentioned in the #3089 PR, one way to fix the problem could be to remove the call to subscribe_to_viewer_nodes_name_changes() from the VLN register function.. but that means it would have to be added somewhere else (e.g. sv_init?) so that the new VLN nodes would have the subscriptions set.

One problem with this (though it may not be a big problem) is that this subscription call would be made multiple times for every VLN node created, when in fact this should be done only one time (at least given the way the subscriptions are set right now). The VLN subscription essentially registers a VLN function as a callback in which then all the VLN nodes in the tree are notified about any viewer name change:

def viewer_name_change_callback(self):
    ''' Subscription callback for viewer node name change (calls from handlers.py) '''
    # propagate the name change callback to all Viewer Layer nodes
    for node_tree in sverchok_trees():
        layer_nodes = [n for n in node_tree.nodes if n.bl_idname == "SvViewerLayerNode"]
        for node in layer_nodes:
            node.viewer_changed_name()

def subscribe_to_viewer_nodes_name_changes():
    ''' Subscribe to name change of various viewer nodes (calls to handlers.py) '''
    VIZ_NODE1 = sverchok.nodes.viz.vd_draw_experimental.SvVDExperimental
    VIZ_NODE2 = sverchok.nodes.viz.viewer_idx28.SvIDXViewer28

    subscribe_to_list = [(VIZ_NODE1, "name"), (VIZ_NODE2, "name")]

    for subscribe_to in subscribe_to_list:
        subscribe_to_changes(subscribe_to, "Viewer node name changed", viewer_name_change_callback)

If the subscriptions would be done in the sv_init of every VLN node then maybe a better way to setp the subscriptions would be to have each VLN node subscribe to changes by providing a node method as a callback (rather then a global method that calls all the VLN nodes as shown above). In this case though, I’d have to figure out a way for these callbacks to be properly set on loading the blend file (the current implementation covers both cases.. new VLN nodes or reloading file with VLN nodes in it). I’ll have to think more about this.

Let me know if you have any suggestions.

DolphinDream commented 4 years ago

Nice.. :(

When I provide self.method to subscribe .. I get an error:

  subscribe_to_changes(subscribe_to, "Viewer node name changed", self.viewer_name_change_callback)
  File "/Users/atokirina/Library/Application Support/Blender/2.82/scripts/addons/sverchok/core/handlers.py", line 35, in subscribe_to_changes
    options={"PERSISTENT", }
TypeError: notify expects a function, found method

apparently the bpy.msgbus.subscribe_rna doesn’t like methods as a notification callback. wtf?

vicdoval commented 4 years ago

Are you sure you dont want to try this? https://github.com/nortikin/sverchok/pull/3089#issuecomment-621512702

DolphinDream commented 4 years ago

@vicdoval sure.. that would be a solution :) though this msgbus mechanism may be useful in other cases.. so figuring out how to make it work in this case may be useful nonetheless.

Durman commented 4 years ago

apparently the bpy.msgbus.subscribe_rna doesn’t like methods as a notification callback. wtf?

It looks like update parameter of a property. It takes only functions, but also there is no complaints about static methods.

portnov commented 4 years ago

annotations

``` Warning: class SvTextInNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/text/text_in_mk2.py:565 assign as a type annotation: SvTextInNodeMK2.is_animatable assign as a type annotation: SvTextInNodeMK2.refresh Warning: class SvDisplaceNode contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvDisplaceNode.is_animatable assign as a type annotation: SvDisplaceNode.refresh Warning: class SvNeuroElman1LNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/logic/neuro_elman.py:317 assign as a type annotation: SvNeuroElman1LNode.is_animatable assign as a type annotation: SvNeuroElman1LNode.refresh Warning: class SvObjectToMeshNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/scene/blenddata_to_svdata2.py:108 assign as a type annotation: SvObjectToMeshNodeMK2.is_animatable assign as a type annotation: SvObjectToMeshNodeMK2.refresh Warning: class SvCollectionPicker contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvCollectionPicker.is_animatable assign as a type annotation: SvCollectionPicker.refresh Warning: class SvFrameInfoNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/scene/frame_info_mk2.py:86 assign as a type annotation: SvFrameInfoNodeMK2.is_animatable assign as a type annotation: SvFrameInfoNodeMK2.refresh Warning: class SvCurveInputNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/scene/curve_in.py:231 assign as a type annotation: SvCurveInputNode.is_animatable assign as a type annotation: SvCurveInputNode.refresh Warning: class SvUVtextureNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/scene/uv_texture.py:128 assign as a type annotation: SvUVtextureNode.is_animatable assign as a type annotation: SvUVtextureNode.refresh Warning: class SvObjectsNodeMK3 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/scene/objects_mk3.py:340 assign as a type annotation: SvObjectsNodeMK3.is_animatable assign as a type annotation: SvObjectsNodeMK3.refresh Warning: class SvParticlesMK2Node contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/scene/particles_MK2.py:92 assign as a type annotation: SvParticlesMK2Node.is_animatable assign as a type annotation: SvParticlesMK2Node.refresh Warning: class SvSweepModulator contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvSweepModulator.is_animatable assign as a type annotation: SvSweepModulator.refresh Warning: class UdpClientNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/network/udp_client.py:95 assign as a type annotation: UdpClientNode.is_animatable assign as a type annotation: UdpClientNode.refresh Warning: class SvScriptNodeLite contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvScriptNodeLite.is_animatable assign as a type annotation: SvScriptNodeLite.refresh Warning: class SvLatticePropsNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/lattice_analyzer.py:64 assign as a type annotation: SvLatticePropsNode.is_animatable assign as a type annotation: SvLatticePropsNode.refresh Warning: class SvAssignMaterialListNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/assign_materials.py:189 assign as a type annotation: SvAssignMaterialListNode.is_animatable assign as a type annotation: SvAssignMaterialListNode.refresh Warning: class SvOBJRayCastNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/object_raycast2.py:115 assign as a type annotation: SvOBJRayCastNodeMK2.is_animatable assign as a type annotation: SvOBJRayCastNodeMK2.refresh Warning: class SvPointOnMeshNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/closest_point_on_mesh2.py:91 assign as a type annotation: SvPointOnMeshNodeMK2.is_animatable assign as a type annotation: SvPointOnMeshNodeMK2.refresh Warning: class SvSampleUVColorNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/sample_uv_color.py:76 assign as a type annotation: SvSampleUVColorNode.is_animatable assign as a type annotation: SvSampleUVColorNode.refresh Warning: class SvSelectMeshVerts contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/select_mesh_verts.py:100 assign as a type annotation: SvSelectMeshVerts.is_animatable assign as a type annotation: SvSelectMeshVerts.refresh Warning: class SvSCNRayCastNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/scene_raycast2.py:69 assign as a type annotation: SvSCNRayCastNodeMK2.is_animatable assign as a type annotation: SvSCNRayCastNodeMK2.refresh Warning: class SvVertexGroupNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/weightsmk2.py:87 assign as a type annotation: SvVertexGroupNodeMK2.is_animatable assign as a type annotation: SvVertexGroupNodeMK2.refresh Warning: class SvSetDataObjectNodeMK2 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/set_blenddata2.py:97 assign as a type annotation: SvSetDataObjectNodeMK2.is_animatable assign as a type annotation: SvSetDataObjectNodeMK2.refresh Warning: class SvUVPointonMeshNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/points_from_uv_to_mesh.py:102 assign as a type annotation: SvUVPointonMeshNode.is_animatable assign as a type annotation: SvUVPointonMeshNode.refresh Warning: class SvSetCustomMeshNormals contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/custom_mesh_normals.py:65 assign as a type annotation: SvSetCustomMeshNormals.is_animatable assign as a type annotation: SvSetCustomMeshNormals.refresh Warning: class SvGetPropNodeMK2 contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvGetPropNodeMK2.is_animatable assign as a type annotation: SvGetPropNodeMK2.refresh Warning: class SvGetPropNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/getsetprop.py:306 assign as a type annotation: SvGetPropNode.is_animatable assign as a type annotation: SvGetPropNode.refresh Warning: class SvGetAssetProperties contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/get_asset_properties.py:252 assign as a type annotation: SvGetAssetProperties.is_animatable assign as a type annotation: SvGetAssetProperties.refresh Warning: class SvMeshUVColorNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/color_uv_texture.py:81 assign as a type annotation: SvMeshUVColorNode.is_animatable assign as a type annotation: SvMeshUVColorNode.refresh Warning: class SvSetCustomUVMap contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/set_custom_uv_map.py:85 assign as a type annotation: SvSetCustomUVMap.is_animatable assign as a type annotation: SvSetCustomUVMap.refresh Warning: class SvArmaturePropsNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/armature_analyzer.py:74 assign as a type annotation: SvArmaturePropsNode.is_animatable assign as a type annotation: SvArmaturePropsNode.refresh Warning: class SvMaterialIndexNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/object_nodes/material_index.py:144 assign as a type annotation: SvMaterialIndexNode.is_animatable assign as a type annotation: SvMaterialIndexNode.refresh Warning: class SvCurveMapperNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/number/curve_mapper.py:148 assign as a type annotation: SvCurveMapperNode.is_animatable assign as a type annotation: SvCurveMapperNode.refresh Warning: class SvMeshEvalNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/generators_extended/mesh_eval.py:549 assign as a type annotation: SvMeshEvalNode.is_animatable assign as a type annotation: SvMeshEvalNode.refresh Warning: class SvProfileNodeMK3 contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/generators_extended/profile_mk3.py:639 assign as a type annotation: SvProfileNodeMK3.is_animatable assign as a type annotation: SvProfileNodeMK3.refresh Warning: class SvExecNodeMod contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/script/multi_exec.py:252 assign as a type annotation: SvExecNodeMod.is_animatable assign as a type annotation: SvExecNodeMod.refresh Warning: class SvSNFunctorB contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvSNFunctorB.is_animatable assign as a type annotation: SvSNFunctorB.refresh Warning: class SvTextureEvaluateNode contains a property which should be an annotation! /home/portnov/SSD/soft/blender-2.82-linux64/2.82/scripts/modules/bpy/utils/__init__.py:712 assign as a type annotation: SvTextureEvaluateNode.is_animatable assign as a type annotation: SvTextureEvaluateNode.refresh Warning: class SvPulgaPhysicsNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/modifier_change/pulga_physics.py:556 assign as a type annotation: SvPulgaPhysicsNode.is_animatable assign as a type annotation: SvPulgaPhysicsNode.refresh Warning: class SvOBJInsolationNode contains a property which should be an annotation! /home/portnov/.config/blender/2.82/scripts/addons_contrib/sverchok/nodes/analyzer/object_insolation.py:217 assign as a type annotation: SvOBJInsolationNode.is_animatable assign as a type annotation: SvOBJInsolationNode.refresh ```
?
zeffii commented 4 years ago

annotations resolved here https://github.com/nortikin/sverchok/commit/ac41b6970d327ca350224c93e52fe25cd8e53057

vicdoval commented 4 years ago

annotations also fixed here #3152 :D