void BakedLightEditor::_bake_pressed() {

	ERR_FAIL_COND(!node);
	if (node->get_baked_light().is_null()) {
		err_dialog->set_text("BakedLightInstance does not contain a BakedLight resource.");
		err_dialog->popup_centered(Size2(350,70));
		button_bake->set_pressed(false);
		return;
	}

	if (baker->is_baking()) {

		baker->set_pause(!button_bake->is_pressed());
		if (baker->is_paused()) {

			set_process(false);
			bake_info->set_text("");
		} else {

			update_timeout=0;
			set_process(true);
		}

	} else {
		baker->bake(node->get_baked_light(),node);
		update_timeout=0;
		set_process(true);
	}

}
void CollisionPolygonEditor::edit(Node *p_collision_polygon) {



	if (p_collision_polygon) {

		node=p_collision_polygon->cast_to<CollisionPolygon>();
		wip.clear();
		wip_active=false;
		edited_point=-1;
		p_collision_polygon->add_child(imgeom);
		_polygon_draw();
		set_process(true);
		prev_depth=-1;

	} else {
		node=NULL;

		if (imgeom->get_parent())
			imgeom->get_parent()->remove_child(imgeom);

		set_process(false);
	}

}
void Polygon3DEditor::edit(Node *p_collision_polygon) {

	if (p_collision_polygon) {

		node = Object::cast_to<Spatial>(p_collision_polygon);
		//Enable the pencil tool if the polygon is empty
		if (Vector<Vector2>(node->call("get_polygon")).size() == 0) {
			_menu_option(MODE_CREATE);
		}
		wip.clear();
		wip_active = false;
		edited_point = -1;
		p_collision_polygon->add_child(imgeom);
		_polygon_draw();
		set_process(true);
		prev_depth = -1;

	} else {
		node = NULL;

		if (imgeom->get_parent())
			imgeom->get_parent()->remove_child(imgeom);

		set_process(false);
	}
}
Пример #4
0
void InterpolatedCamera::set_interpolation_enabled(bool p_enable) {

	if (enabled == p_enable)
		return;
	enabled = p_enable;
	if (p_enable) {
		if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
			return;
		set_process(true);
	} else
		set_process(false);
}
Пример #5
0
void ExportTemplateManager::_begin_template_download(const String &p_url) {

	for (int i = 0; i < template_list->get_child_count(); i++) {
		BaseButton *b = Object::cast_to<BaseButton>(template_list->get_child(0));
		if (b) {
			b->set_disabled(true);
		}
	}

	download_data.clear();

	Error err = download_templates->request(p_url);
	if (err != OK) {
		EditorNode::get_singleton()->show_warning(TTR("Error requesting url: ") + p_url);
		return;
	}

	set_process(true);

	template_list_state->show();
	template_download_progress->set_max(100);
	template_download_progress->set_value(0);
	template_download_progress->show();
	template_list_state->set_text(TTR("Connecting to Mirror.."));
}
Пример #6
0
void UI_List::SetSpaceY(int v) {
	if (spacey_ != v) {
		spacey_ = v;
		layout_ = true;
		set_process(true);
	}
}
Пример #7
0
void UI_List::_notification(int p_what) {
	if (setattribute_) {
		content_->set_size(get_size());
		unsigned count = box_->get_child_count();
		UI_Box* node = NULL;
		for (unsigned i = 0; i < count; i++) {
			node = Object::cast_to<UI_Box>(box_->get_child(i));
			if (node) {
				node->set_visible(false);
			}
		}
		int len = data_.size();
		for (unsigned i = 0; i < len; i++) {
			if (box_->get_child_count() <= i) {
				node = memnew(UI_Box);
				node->SetXml(render_, NULL);
				node->set_name("ui_list_item_" + itos(i));
				box_->add_child(node);
			}
			else {
				node = Object::cast_to<UI_Button>(box_->get_child(i));
			}
			node->set_visible(true);
			node->SetDataSource(data_[i]);
		}
		setattribute_ = false;
		return;
	}
	if (layout_) {
		int count = box_->get_child_count();
		int rx = 0;
		int ry = 0;
		real_t x = 0;
		real_t y = 0;
		UI_Box* node = NULL;
		Size2 size;
		Size2 max;
		for (unsigned i = 0; i < count; i++) {
			node = Object::cast_to<UI_Box>(box_->get_child(i));
			size = node->get_size();
			rx = i % repeatx_;
			ry = i / repeatx_;
			x = size.width * rx + rx * spacex_;
			y = size.height * ry + ry * spacey_;
			node->set_position(Point2(x, y));
			max.width = x + size.width;
			max.height = y + size.height;
		}
		max.width -= spacex_;
		max.height -= spacey_;
		node_size.width = size.width + spacex_;
		node_size.height = size.height + spacey_;
		size = get_size();
		if (size.width > max.width)max.width = size.width;
		if (size.height > max.height)max.height = size.height;
		box_->set_size(max);
		layout_ = false;
		set_process(false);
	}
}
Пример #8
0
void EditorFileSystem::scan_sources() {

	if (scanning || scanning_sources|| thread)
		return;

	sources_changed.clear();
	scanning_sources=true;
	scanning_sources_done=false;

	abort_scan=false;

	if (!use_threads) {
		if (filesystem)
			_scan_sources(filesystem,NULL);
		scanning_sources=false;
		scanning_sources_done=true;
		emit_signal("sources_changed",sources_changed.size()>0);
	} else {

		ERR_FAIL_COND(thread_sources);
		set_process(true);
		Thread::Settings s;
		ss_amount=0;
		s.priority=Thread::PRIORITY_LOW;
		thread_sources = Thread::create(_thread_func_sources,this,s);
		//tree->hide();
		//print_line("SCAN BEGIN!");
		//progress->show();
	}



}
void SampleLibraryEditor::_notification(int p_what) {

    if (p_what==NOTIFICATION_PROCESS) {
        if (is_playing && !player->is_active()) {
            TreeItem *tl=last_sample_playing->cast_to<TreeItem>();
            tl->set_button(0,0,get_icon("Play","EditorIcons"));
            is_playing = false;
            set_process(false);
        }
    }

    if (p_what==NOTIFICATION_ENTER_TREE) {
        load->set_icon( get_icon("Folder","EditorIcons") );
        load->set_tooltip("Open Sample File(s)");
    }

    if (p_what==NOTIFICATION_READY) {

//		NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true);
    }

    if (p_what==NOTIFICATION_DRAW) {

    }
}
Пример #10
0
void ExportTemplateManager::_begin_template_download(const String &p_url) {

	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
		OS::get_singleton()->shell_open(p_url);
		return;
	}

	for (int i = 0; i < template_list->get_child_count(); i++) {
		BaseButton *b = Object::cast_to<BaseButton>(template_list->get_child(0));
		if (b) {
			b->set_disabled(true);
		}
	}

	download_data.clear();
	download_templates->set_download_file(EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_templates.tpz"));
	download_templates->set_use_threads(true);

	Error err = download_templates->request(p_url);
	if (err != OK) {
		EditorNode::get_singleton()->show_warning(TTR("Error requesting url: ") + p_url);
		return;
	}

	set_process(true);

	template_list_state->show();
	template_download_progress->set_max(100);
	template_download_progress->set_value(0);
	template_download_progress->show();
	template_list_state->set_text(TTR("Connecting to Mirror..."));
}
Пример #11
0
void ScriptEditorDebugger::stop(){


	set_process(false);

	server->stop();

	ppeer->set_stream_peer(Ref<StreamPeer>());

	if (connection.is_valid()) {
		EditorNode::get_log()->add_message("** Debug Process Stopped **");
		connection.unref();
	}

	pending_in_queue=0;
	message.clear();

	if (log_forced_visible) {
		EditorNode::get_log()->hide();
		log_forced_visible=false;
	}

	node_path_cache.clear();
	res_path_cache.clear();
	le_clear->set_disabled(false);
	le_set->set_disabled(true);


	hide();
	emit_signal("show_debugger",false);

}
void BakedLightEditor::_menu_option(int p_option) {


	switch(p_option) {


		case MENU_OPTION_BAKE: {

			ERR_FAIL_COND(!node);
			ERR_FAIL_COND(node->get_baked_light().is_null());
			baker->bake(node->get_baked_light(),node);
			node->get_baked_light()->set_mode(BakedLight::MODE_OCTREE);
			update_timeout=0;
			set_process(true);


		} break;
		case MENU_OPTION_CLEAR: {



		} break;

	}
}
void BakedLightEditor::_end_baking() {

	baker->clear();
	set_process(false);
	button_bake->set_pressed(false);
	bake_info->set_text("");
}
Пример #14
0
void Timer::_set_process(bool p_process, bool p_force) 
{
	switch (timer_process_mode) {
		case TIMER_PROCESS_FIXED: set_fixed_process(p_process); break;
		case TIMER_PROCESS_IDLE: set_process(p_process); break;
	}
}
Пример #15
0
void AnimationPlayerEditor::set_state(const Dictionary& p_state) {

	if (p_state.has("visible") && p_state["visible"]) {

		Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["player"]);
		if (n && n->cast_to<AnimationPlayer>()) {
			player=n->cast_to<AnimationPlayer>();
			_update_player();
			show();
			set_process(true);
			ensure_visibility();
			EditorNode::get_singleton()->animation_panel_make_visible(true);

			if (p_state.has("animation")) {
				String anim = p_state["animation"];
				_select_anim_by_name(anim);
				if (p_state.has("editing") && p_state["editing"]) {

					edit_anim->set_pressed(true);
					_animation_edit();
				}
			}

		}
	}

}
Пример #16
0
void VideoPlayer::set_paused(bool p_paused) {

	paused=p_paused;
	if (stream.is_valid()) {
		stream->set_paused(p_paused);
		set_process(!p_paused);
	};
};
Пример #17
0
void UI_List::SetData(const Variant& arr) {
	if (arr.is_array()) {
		data_ = arr;
		setattribute_ = true;
		layout_ = true;
		set_process(true);
	}
}
Пример #18
0
EditorRunNative::EditorRunNative() {
	set_process(true);
	first = true;
	deploy_dumb = false;
	deploy_debug_remote = false;
	debug_collisions = false;
	debug_navigation = false;
}
Пример #19
0
void NetGameServer::_update_signal_mode()
{
	set_process(false);
	set_fixed_process(false);
	switch(signal_mode)
	{
		case PROCESS:
			set_process(true);
			break;
		case FIXED:
			set_fixed_process(true);
			break;
		case THREADED:
			// noop
			break;
	}
}
Пример #20
0
void AnimatedSprite::_set_playing(bool p_playing) {

	if (playing==p_playing)
		return;
	playing=p_playing;
	_reset_timeout();
	set_process(playing);
}
Пример #21
0
void EditorFileDialog::_request_single_thumbnail(const String& p_path) {

	EditorResourcePreview::get_singleton()->queue_resource_preview(p_path,this,"_thumbnail_done",p_path);
	print_line("want file "+p_path);
	set_process(true);
	preview_waiting=true;
	preview_wheel_timeout=0;

}
Пример #22
0
void VideoPlayer::play() {

	ERR_FAIL_COND(!is_inside_scene());
	if (stream.is_null())
		return;
	stream->play();
	AudioServer::get_singleton()->stream_set_active(stream_rid,true);
	AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,volume);
	set_process(true);
};
void Polygon3DEditor::_node_removed(Node *p_node) {

	if (p_node == node) {
		node = NULL;
		if (imgeom->get_parent() == p_node)
			p_node->remove_child(imgeom);
		hide();
		set_process(false);
	}
}
Пример #24
0
void VideoPlayer::stop() {

	if (!is_inside_scene())
		return;
	if (stream.is_null())
		return;

	AudioServer::get_singleton()->stream_set_active(stream_rid,false);
	stream->stop();
	set_process(false);
};
void AnimationPlayerEditor::_hide_anim_editors() {

	player=NULL;
	hide();
	set_process(false);

	key_editor->set_animation(Ref<Animation>());
	key_editor->set_root(NULL);
//		editor->animation_editor_make_visible(false);

}
Пример #26
0
void EditorAssetLibraryItemDownload::_make_request() {
	download->cancel_request();
	download->set_download_file(EditorSettings::get_singleton()->get_settings_path().plus_file("tmp").plus_file("tmp_asset_" + itos(asset_id)) + ".zip");

	Error err = download->request(host);
	if (err != OK) {
		status->set_text("Error making request");
	} else {
		set_process(true);
	}
}
Пример #27
0
void HTTPRequest::_notification(int p_what) {

	if (p_what==NOTIFICATION_PROCESS) {

		bool done = _update_connection();
		if (done) {

			set_process(false);
			cancel_request();
		}
	}
}
Пример #28
0
void Timer::set_timer_process_mode(TimerProcessMode p_mode) {

	if (timer_process_mode == p_mode)
		return;

	switch (timer_process_mode) {
		case TIMER_PROCESS_FIXED:
			if (is_fixed_processing()) {
				set_fixed_process(false);
				set_process(true);
			}
		break;
		case TIMER_PROCESS_IDLE:
			if (is_processing()) {
				set_process(false);
				set_fixed_process(true);
			}
		break;
	}
	timer_process_mode = p_mode;
}
void BakedLightEditor::_bake_pressed() {

	ERR_FAIL_COND(!node);
	const String conf_warning = node->get_configuration_warning();
	if (!conf_warning.empty()) {
		err_dialog->set_text(conf_warning);
		err_dialog->popup_centered_minsize();
		button_bake->set_pressed(false);
		return;
	}

	if (baker->is_baking()) {

		baker->set_pause(!button_bake->is_pressed());
		if (baker->is_paused()) {

			set_process(false);
			bake_info->set_text("");
			button_reset->show();
			button_make_lightmaps->show();

		} else {

			update_timeout=0;
			set_process(true);
			button_make_lightmaps->hide();
			button_reset->hide();
		}
	} else {
		baker->bake(node->get_baked_light(),node);
		node->get_baked_light()->set_mode(BakedLight::MODE_OCTREE);
		update_timeout=0;

		last_rays_time=0;
		button_bake->set_pressed(false);

		set_process(true);
	}

}
Пример #30
0
void AnimationPlayerEditor::_hide_anim_editors() {

	player=NULL;
	hide();
	set_process(false);
	if (edit_anim->is_pressed()) {

		editor->get_animation_editor()->set_animation(Ref<Animation>());
		editor->get_animation_editor()->set_root(NULL);
		editor->animation_editor_make_visible(false);
		edit_anim->set_pressed(false);
	}
}