本文整理汇总了C++中Spatial::is_visible方法的典型用法代码示例。如果您正苦于以下问题:C++ Spatial::is_visible方法的具体用法?C++ Spatial::is_visible怎么用?C++ Spatial::is_visible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spatial
的用法示例。
在下文中一共展示了Spatial::is_visible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _cell_button_pressed
void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) {
TreeItem *item=p_item->cast_to<TreeItem>();
ERR_FAIL_COND(!item);
NodePath np = item->get_metadata(0);
Node *n=get_node(np);
ERR_FAIL_COND(!n);
if (p_id==BUTTON_SUBSCENE) {
//open scene request
Rect2 item_rect = tree->get_item_rect(item,0);
item_rect.pos.y-=tree->get_scroll().y;
item_rect.pos+=tree->get_global_pos();
if (n==get_scene_node()) {
inheritance_menu->set_pos(item_rect.pos+Vector2(0,item_rect.size.y));
inheritance_menu->set_size(Vector2(item_rect.size.x,0));
inheritance_menu->popup();
instance_node=n->get_instance_ID();
} else {
instance_menu->set_pos(item_rect.pos+Vector2(0,item_rect.size.y));
instance_menu->set_size(Vector2(item_rect.size.x,0));
if (EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(n))
instance_menu->set_item_checked(0,true);
else
instance_menu->set_item_checked(0,false);
if (n->get_owner()==get_scene_node()) {
instance_menu->set_item_checked(1,n->get_scene_instance_load_placeholder());
instance_menu->set_item_disabled(1,false);
} else {
instance_menu->set_item_checked(1,false);
instance_menu->set_item_disabled(1,true);
}
instance_menu->popup();
instance_node=n->get_instance_ID();
}
//emit_signal("open",n->get_filename());
} else if (p_id==BUTTON_SCRIPT) {
RefPtr script=n->get_script();
if (!script.is_null())
emit_signal("open_script",script);
} else if (p_id==BUTTON_VISIBILITY) {
if (n->is_type("Spatial")) {
Spatial *ci = n->cast_to<Spatial>();
if (!ci->is_visible() && ci->get_parent_spatial() && !ci->get_parent_spatial()->is_visible()) {
error->set_text(TTR("This item cannot be made visible because the parent is hidden. Unhide the parent first."));
error->popup_centered_minsize();
return;
}
bool v = !bool(n->call("is_hidden"));
undo_redo->create_action(TTR("Toggle Spatial Visible"));
undo_redo->add_do_method(n,"_set_visible_",!v);
undo_redo->add_undo_method(n,"_set_visible_",v);
undo_redo->commit_action();
} else if (n->is_type("CanvasItem")) {
CanvasItem *ci = n->cast_to<CanvasItem>();
if (!ci->is_visible() && ci->get_parent_item() && !ci->get_parent_item()->is_visible()) {
error->set_text(TTR("This item cannot be made visible because the parent is hidden. Unhide the parent first."));
error->popup_centered_minsize();
return;
}
bool v = !bool(n->call("is_hidden"));
undo_redo->create_action(TTR("Toggle CanvasItem Visible"));
undo_redo->add_do_method(n,v?"hide":"show");
undo_redo->add_undo_method(n,v?"show":"hide");
undo_redo->commit_action();
}
} else if (p_id==BUTTON_LOCK) {
if (n->is_type("CanvasItem")) {
n->set_meta("_edit_lock_", Variant());
_update_tree();
emit_signal("node_changed");
}
} else if (p_id==BUTTON_GROUP) {
if (n->is_type("CanvasItem")) {
n->set_meta("_edit_group_", Variant());
_update_tree();
emit_signal("node_changed");
}
} else if (p_id==BUTTON_WARNING) {
String config_err = n->get_configuration_warning();
if (config_err==String())
return;
config_err=config_err.word_wrap(80);
//.........这里部分代码省略.........