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

obtain child comment graph pos

Community Beginner ,
Oct 16, 2023 Oct 16, 2023

Copy link to clipboard

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

Translate

Translate

Report

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

Copy link to clipboard

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

 

regards,

phil

Votes

Translate

Translate

Report

Report