當前位置: 首頁>>代碼示例>>C++>>正文


C++ ERR_FAIL_NULL函數代碼示例

本文整理匯總了C++中ERR_FAIL_NULL函數的典型用法代碼示例。如果您正苦於以下問題:C++ ERR_FAIL_NULL函數的具體用法?C++ ERR_FAIL_NULL怎麽用?C++ ERR_FAIL_NULL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ERR_FAIL_NULL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: switch

void ARVROrigin::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_TREE: {
			set_process_internal(true);
		}; break;
		case NOTIFICATION_EXIT_TREE: {
			set_process_internal(false);
		}; break;
		case NOTIFICATION_INTERNAL_PROCESS: {
			// get our ARVRServer
			ARVRServer *arvr_server = ARVRServer::get_singleton();
			ERR_FAIL_NULL(arvr_server);

			// set our world origin to our node transform
			arvr_server->set_world_origin(get_global_transform());

			// check if we have a primary interface
			Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
			if (arvr_interface.is_valid() && tracked_camera != NULL) {
				// get our positioning transform for our headset
				Transform t = arvr_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, Transform());

				// now apply this to our camera
				tracked_camera->set_transform(t);
			};
		}; break;
		default:
			break;
	};
};
開發者ID:bigscorpions,項目名稱:godot,代碼行數:30,代碼來源:arvr_nodes.cpp

示例2: ERR_FAIL_NULL

void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata) {

	ERR_FAIL_NULL(p_receiver);
	ERR_FAIL_COND(!p_res.is_valid());

	preview_mutex->lock();

	String path_id = "ID:" + itos(p_res->get_instance_id());

	if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version()) {

		cache[path_id].order = order++;
		p_receiver->call_deferred(p_receiver_func, path_id, cache[path_id].preview, p_userdata);
		preview_mutex->unlock();
		return;
	}

	cache.erase(path_id); //erase if exists, since it will be regen

	//print_line("send to thread "+p_path);
	QueueItem item;
	item.function = p_receiver_func;
	item.id = p_receiver->get_instance_id();
	item.resource = p_res;
	item.path = path_id;
	item.userdata = p_userdata;

	queue.push_back(item);
	preview_mutex->unlock();
	preview_sem->post();
}
開發者ID:rrrfffrrr,項目名稱:godot,代碼行數:31,代碼來源:editor_resource_preview.cpp

示例3: ERR_FAIL_NULL

void Object::disconnect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method) {

	ERR_FAIL_NULL(p_to_object);
	Signal *s = signal_map.getptr(p_signal);
	if (!s) {
		ERR_EXPLAIN("Nonexistent signal: "+p_signal);
		ERR_FAIL_COND(!s);
	}
	if (s->lock>0) {
		ERR_EXPLAIN("Attempt to disconnect signal '"+p_signal+"' while emitting (locks: "+itos(s->lock)+")");
		ERR_FAIL_COND(s->lock>0);
	}

	Signal::Target target(p_to_object->get_instance_ID(),p_to_method);

	if (!s->slot_map.has(target)) {
		ERR_EXPLAIN("Disconnecting nonexistent signal '"+p_signal+"', slot: "+itos(target._id)+":"+target.method);
		ERR_FAIL();
	}

	p_to_object->connections.erase(s->slot_map[target].cE);
	s->slot_map.erase(target);

	if (s->slot_map.empty() && ObjectTypeDB::has_signal(get_type_name(),p_signal )) {
		//not user signal, delete
		signal_map.erase(p_signal);
	}
}
開發者ID:Brickcaster,項目名稱:godot,代碼行數:28,代碼來源:object.cpp

示例4: ERR_FAIL_NULL

void Node::move_child(Node *p_child,int p_pos) {	
	
	ERR_FAIL_NULL(p_child);
	ERR_EXPLAIN("Invalid new child position: "+itos(p_pos));
	ERR_FAIL_INDEX( p_pos, data.children.size()+1 );
	ERR_EXPLAIN("child is not a child of this node.");
	ERR_FAIL_COND(p_child->data.parent!=this);
	ERR_FAIL_COND(data.blocked>0);
	
	data.children.remove( p_child->data.pos );
	data.children.insert( p_pos, p_child );

	if (data.tree) {
		data.tree->tree_changed();
	}

	data.blocked++;
	//new pos first
	for (int i=0;i<data.children.size();i++) {
		
		data.children[i]->data.pos=i;
	}
	// notification second
	move_child_notify(p_child);
	for (int i=0;i<data.children.size();i++) {
		data.children[i]->notification( NOTIFICATION_MOVED_IN_PARENT );

	}

	data.blocked--;

}
開發者ID:Martho42,項目名稱:godot,代碼行數:32,代碼來源:node.cpp

示例5: ERR_FAIL_NULL

void Camera2D::set_custom_viewport(Node *p_viewport) {
	ERR_FAIL_NULL(p_viewport);
	if (is_inside_tree()) {
		remove_from_group(group_name);
		remove_from_group(canvas_group_name);
	}

	custom_viewport = Object::cast_to<Viewport>(p_viewport);

	if (custom_viewport) {
		custom_viewport_id = custom_viewport->get_instance_id();
	} else {
		custom_viewport_id = 0;
	}

	if (is_inside_tree()) {

		if (custom_viewport)
			viewport = custom_viewport;
		else
			viewport = get_viewport();

		RID vp = viewport->get_viewport_rid();
		group_name = "__cameras_" + itos(vp.get_id());
		canvas_group_name = "__cameras_c" + itos(canvas.get_id());
		add_to_group(group_name);
		add_to_group(canvas_group_name);
	}
}
開發者ID:jejung,項目名稱:godot,代碼行數:29,代碼來源:camera_2d.cpp

示例6: ERR_FAIL_NULL

void ARVROrigin::set_world_scale(float p_world_scale) {
	// get our ARVRServer
	ARVRServer *arvr_server = ARVRServer::get_singleton();
	ERR_FAIL_NULL(arvr_server);

	arvr_server->set_world_scale(p_world_scale);
};
開發者ID:bigscorpions,項目名稱:godot,代碼行數:7,代碼來源:arvr_nodes.cpp

示例7: ERR_FAIL_NULL

void RayCast::add_exception(const Object* p_object){

	ERR_FAIL_NULL(p_object);
	CollisionObject *co=((Object*)p_object)->cast_to<CollisionObject>();
	if (!co)
		return;
	add_exception_rid(co->get_rid());
}
開發者ID:AwsomeGameEngine,項目名稱:godot,代碼行數:8,代碼來源:ray_cast.cpp

示例8: ERR_FAIL_NULL

void Skeleton::unbind_child_node_from_bone(int p_bone, Node *p_node) {

	ERR_FAIL_NULL(p_node);
	ERR_FAIL_INDEX(p_bone, bones.size());

	uint32_t id = p_node->get_instance_id();
	bones.write[p_bone].nodes_bound.erase(id);
}
開發者ID:dataxerik,項目名稱:godot,代碼行數:8,代碼來源:skeleton.cpp

示例9: ERR_FAIL_NULL

void RayCast2D::remove_exception(const Object* p_object){

	ERR_FAIL_NULL(p_object);
	CollisionObject2D *co=((Object*)p_object)->cast_to<CollisionObject2D>();
	if (!co)
		return;
	remove_exception_rid(co->get_rid());
}
開發者ID:3miu,項目名稱:godot,代碼行數:8,代碼來源:ray_cast_2d.cpp

示例10: ERR_FAIL_NULL

void Range::share(Range *p_range) {

	ERR_FAIL_NULL(p_range);

	p_range->_ref_shared(shared);
	p_range->_changed_notify();
	p_range->_value_changed_notify();
}
開發者ID:GalanCM,項目名稱:godot,代碼行數:8,代碼來源:range.cpp

示例11: ERR_FAIL_NULL

void RayCast2D::add_exception(const Object *p_object) {

	ERR_FAIL_NULL(p_object);
	const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
	if (!co)
		return;
	add_exception_rid(co->get_rid());
}
開發者ID:KellyThomas,項目名稱:godot,代碼行數:8,代碼來源:ray_cast_2d.cpp

示例12: get_parent

void BTCompositeNode::add_child_node(BTNode& child, Vector<BehaviorTree::Node*>& node_hierarchy) {
	BTNode* p_parent = get_parent() ? get_parent()->cast_to<BTNode>() : NULL;
	ERR_EXPLAIN("Parent node is not a BTNode.");
	ERR_FAIL_NULL(p_parent);
	if (p_parent) {
		node_hierarchy.push_back(get_behavior_node());
		p_parent->add_child_node(child, node_hierarchy);
	}
}
開發者ID:AntonioModer,項目名稱:godot_behavior_tree,代碼行數:9,代碼來源:bt_composite_node.cpp

示例13: ERR_FAIL_NULL

void PopupPanel::set_child_rect(Control *p_child) {
	ERR_FAIL_NULL(p_child);

	Ref<StyleBox> p = get_stylebox("panel");
	p_child->set_area_as_parent_rect();
	for (int i = 0; i < 4; i++) {
		p_child->set_margin(Margin(i), p->get_margin(Margin(i)));
	}
}
開發者ID:Max-Might,項目名稱:godot,代碼行數:9,代碼來源:popup.cpp

示例14: ERR_FAIL_NULL

void SoftBody::remove_collision_exception_with(Node *p_node) {
	ERR_FAIL_NULL(p_node);
	CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
	if (!collision_object) {
		ERR_EXPLAIN("Collision exception only works between two CollisionObject");
	}
	ERR_FAIL_COND(!collision_object);
	PhysicsServer::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid());
}
開發者ID:KellyThomas,項目名稱:godot,代碼行數:9,代碼來源:soft_body.cpp

示例15: godot_arvr_set_controller_axis

void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative) {
	ARVRServer *arvr_server = ARVRServer::get_singleton();
	ERR_FAIL_NULL(arvr_server);

	InputDefault *input = (InputDefault *)Input::get_singleton();
	ERR_FAIL_NULL(input);

	ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
	if (tracker != NULL) {
		int joyid = tracker->get_joy_id();
		if (joyid != -1) {
			InputDefault::JoyAxis jx;
			jx.min = p_can_be_negative ? -1 : 0;
			jx.value = p_value;
			input->joy_axis(joyid, p_axis, jx);
		}
	}
}
開發者ID:Ranakhamis,項目名稱:godot,代碼行數:18,代碼來源:arvr_interface_gdnative.cpp


注:本文中的ERR_FAIL_NULL函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。