Class: Wiretap::Node
- Inherits:
-
Object
show all
- Defined in:
- lib/wiretap.rb,
ext/node.cpp
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
51
52
53
|
# File 'lib/wiretap.rb', line 51
def parent
@parent
end
|
#server ⇒ Object
Returns the value of attribute server.
50
51
52
|
# File 'lib/wiretap.rb', line 50
def server
@server
end
|
Instance Method Details
#[](path) ⇒ Object
53
54
55
56
|
# File 'lib/wiretap.rb', line 53
def [](path)
return find(path) if path.is_a?(String)
return children[path] if path.is_a?(Numeric)
end
|
#children ⇒ Object
45
46
47
48
49
50
51
52
53
54
|
# File 'ext/nodechildren.cpp', line 45
static VALUE wiretap_node_children(VALUE self) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
VALUE children = Data_Wrap_Struct(cNodeChildren, 0, wiretap_node_children_free, node);
rb_iv_set(children, "@node", self);
rb_iv_set(children, "@server", rb_iv_get(self, "@server"));
return children;
}
|
#create_library(name) {|node| ... } ⇒ Object
Creates a library as a child of the Project node
91
92
93
94
95
|
# File 'lib/wiretap.rb', line 91
def create_library(name)
node = create_node(name, "LIBRARY")
yield node if block_given?
node
end
|
#create_project(name) {|node| ... } ⇒ Object
Creates a project as a child of the Volume node
84
85
86
87
88
|
# File 'lib/wiretap.rb', line 84
def create_project(name)
node = create_node(name, "PROJECT")
yield node if block_given?
node
end
|
#create_reel(name) {|node| ... } ⇒ Object
Creates a reel as a child of a Desktop or Library node
98
99
100
101
102
|
# File 'lib/wiretap.rb', line 98
def create_reel(name)
node = create_node(name, "REEL")
yield node if block_given?
node
end
|
#destroy ⇒ Object
Destroys all the children of the node and node itself
128
129
130
131
|
# File 'lib/wiretap.rb', line 128
def destroy
children.each {|child| child.destroy} rescue nil
destroy!
end
|
#destroy! ⇒ Object
266
267
268
269
270
271
272
|
# File 'ext/node.cpp', line 266
static VALUE wiretap_node_destroy(VALUE self) {
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
NODERUN_E(node, node->destroyNode());
rb_iv_set(self, "@destroyed", Qtrue);
return Qtrue;
}
|
#find(path) ⇒ Object
58
59
60
61
62
|
# File 'lib/wiretap.rb', line 58
def find(path)
return self if path.empty?
return (find_child(path.shift).find(path) rescue nil) if path.respond_to?(:shift)
find_child(path)
end
|
#find_child(path) ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'ext/node.cpp', line 96
static VALUE wiretap_node_find(VALUE self, VALUE path) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Check_Type(path, T_STRING);
Data_Get_Struct(self, WireTapNodeHandle, node);
if(LEN(path) == 0) {
return self;
}
WireTapNodeHandle child;
if(!WireTapFindChild(*node, CSTR(path), child)) {
if(!node->lastError() || !*node->lastError()) {
return Qnil;
}
rb_raise(eError, "Problem while looking for child '%s': %s", CSTR(path), node->lastError());
}
return wiretap_node_create_with(child, rb_iv_get(self, "@server"), self);
}
|
#id ⇒ Object
66
67
68
69
70
71
72
|
# File 'ext/node.cpp', line 66
static VALUE wiretap_node_get_id(VALUE self) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
return rb_str_new2(node->getNodeId().id());
}
|
#id=(id) ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'ext/node.cpp', line 74
static VALUE wiretap_node_set_id(VALUE self, VALUE id) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Check_Type(id, T_STRING);
Data_Get_Struct(self, WireTapNodeHandle, node);
// node->setNodeId(WireTapNodeId(STR(id)));
return self;
}
|
#import_image(name, filename) ⇒ Object
Imports the first frame of an image in PPM format
119
120
121
122
123
124
125
|
# File 'lib/wiretap.rb', line 119
def import_image(name, filename)
format = Wiretap::PPM::format(filename)
node = create_clip(name, "CLIP", format)
node.frames.count = 1
node.frames.write_from_file(0, filename)
node
end
|
#import_video(name, file) ⇒ Object
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/wiretap.rb', line 104
def import_video(name, file)
end
|
#ls ⇒ Object
Returns a list of names of all child nodes
79
80
81
|
# File 'lib/wiretap.rb', line 79
def ls
children.map {|c| c.name}
end
|
Extract metadata from node
@node.metadata
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
# File 'ext/node.cpp', line 280
static VALUE wiretap_node_metadata(VALUE self) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
VALUE metadata = Data_Wrap_Struct(cNodeMetaData, 0, node_leave, node);
rb_iv_set(metadata, "@node", self);
/*
WireTapStr metaDataBody; <--- !
node->getMetaData(streamName, filter, depth)
plainly speaking - somehow this has to happen, all that schtuff
*/
return metadata;
}
|
#name ⇒ Object
190
191
192
193
194
195
196
197
198
|
# File 'ext/node.cpp', line 190
static VALUE wiretap_node_get_name(VALUE self) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
WireTapStr name;
NODERUN_E(node, node->getDisplayName(name));
return wiretap_to_str(name);
}
|
#reload ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
|
# File 'ext/node.cpp', line 84
static VALUE wiretap_node_reload(VALUE self) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
WireTapNodeId id = node->getNodeId();
WireTapServerHandle server = node->getServer();
delete node;
*((WireTapNodeHandle **)&(RDATA(self)->data)) = new WireTapNodeHandle(server, id.id());
return self;
}
|
#to_s ⇒ Object
Also known as:
inspect
73
74
75
|
# File 'lib/wiretap.rb', line 73
def to_s
"#<#{self.class.to_s} '#{self.name}', children: #{self.children.count}>"
end
|
#type ⇒ Object
180
181
182
183
184
185
186
187
188
|
# File 'ext/node.cpp', line 180
static VALUE wiretap_node_get_type(VALUE self) {
Check_Node_Alive(self);
WireTapNodeHandle* node;
Data_Get_Struct(self, WireTapNodeHandle, node);
WireTapStr type;
NODERUN_E(node, node->getNodeTypeStr(type));
return wiretap_to_str(type);
}
|
#uri ⇒ Object
Returns a URL for the node that you can later pass to Wiretap::open Be alert though that it doesn’t use the frame IDs - that is, if you have 7 reels of the same name and you ask for the uri of the second one, the first one is going to be reopened when you pass the uri to Wiretap::open This is done so that you can maintain “soft links” to specific objects on libraries instead of the frame IDs. When the clip gets edited you can still access it by name, although the frame IDs have changed.
69
70
71
|
# File 'lib/wiretap.rb', line 69
def uri
self.server.hostname + '/' + self.id
end
|