MCPcopy Create free account
hub / github.com/SoarGroup/Soar / parse

Method parse

Core/SVS/src/commands/copy_node.cpp:67–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 }
66
67 bool parse()
68 {
69 // ^parent <id>
70 // The id of the parent to attach the node to
71 // Default is the root
72 string parent_id;
73 if (!si->get_const_attr(root, "parent", parent_id))
74 {
75 parent = scn->get_root();
76 }
77 else
78 {
79 parent = scn->get_group(parent_id);
80 if (parent == NULL)
81 {
82 set_status("no group node parent");
83 return false;
84 }
85 }
86
87 // source <id>
88 // The id of the node to copy
89 string source_id;
90 if (!si->get_const_attr(root, "source", source_id))
91 {
92 set_status("must specify a source");
93 return false;
94 }
95
96 source_node = scn->get_node(source_id);
97 if (!source_node)
98 {
99 set_status("Could not find the given source node");
100 return false;
101 }
102
103 // id <id>
104 // the id of the node to create
105 if (!si->get_const_attr(root, "id", node_id))
106 {
107 set_status("^id must be specified");
108 return false;
109 }
110 if (scn->get_node(node_id))
111 {
112 set_status("Node already exists");
113 return false;
114 }
115
116 // ^position <vec3>
117 // ^rotation <vec3>
118 // ^scale <vec3>
119 // All optional - specify transforms on the node
120 // Default to those of the source node
121 transforms['p'] = source_node->get_trans('p');
122 transforms['r'] = source_node->get_trans('r');
123 transforms['s'] = source_node->get_trans('s');
124

Callers

nothing calls this directly

Calls 6

get_const_attrMethod · 0.80
get_groupMethod · 0.80
get_transMethod · 0.80
get_vec3Method · 0.80
get_rootMethod · 0.45
get_nodeMethod · 0.45

Tested by

no test coverage detected