• Global community
• Language:
• Deutsch
• English
• Español
• Français
• Português
• 日本語コミュニティ
Dedicated community for Japanese speakers
• 한국 커뮤니티
Dedicated community for Korean speakers
Exit
• obtain child comment graph pos

# obtain child comment graph pos

Community Beginner ,
Oct 16, 2023 Oct 16, 2023

Copied

could you add a method so we can obtain a child comment's graph position?

i have this plugin that when placing entities(nodes/objects) in scene, it first checks if an entity is selected, if so, it offsets the new entity from that. however when it comes to offsetting something from a selected comment thats a child of a node, then the newly placed entity is badly offset due to the child comment's pos being based off the nodes coordinate system rather than the graphs.

regards,

phil

Idea No status
TOPICS
General , Scripting , Substance Graph

Views

33

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
2 Replies 2
Oct 17, 2023 Oct 17, 2023

Copied

Hi Phil,

The idea is to use the position of the node + the comment's offset.

import sd
from sd.api.sdbasetypes import float2
app = sd.getContext().getSDApplication()
ui_mgr = app.getQtForPythonUIMgr()
graph = ui_mgr.getCurrentGraph()
node = graph.getNodes()[0]
node_pos = node.getPosition()
obj = graph.getGraphObjects()[0]
obj_pos_relative = obj.getPosition()
obj_pos = float2(
node_pos.x + obj_pos_relative.x,
node_pos.y + obj_pos_relative.y
)
print("Node position - " + str(node_pos))
print("Comment position (relative) - " + str(obj_pos_relative))
print("Comment position (absolute) - " + str(obj_pos))

Note that this will work only with a single node graph, and this node must have a comment.

Best regards,

Cyril Dellenbach (Micro) | QA Support Artist | Adobe

Report

Report
Community Beginner ,
Oct 17, 2023 Oct 17, 2023

Copied

LATEST

ty, hopefully a more robust method would be implemented in future.

regards,

phil