예제 #1
0
파일: path.cpp 프로젝트: UgisBrekis/godot
void PathFollow::set_rotation_mode(RotationMode p_rotation_mode) {

	rotation_mode = p_rotation_mode;

	update_configuration_warning();
	_update_transform();
}
예제 #2
0
void SoftBody::_changed_callback(Object *p_changed, const char *p_prop) {
#ifdef TOOLS_ENABLED
	if (p_changed == this) {
		update_configuration_warning();
	}
#endif
}
예제 #3
0
void CanvasModulate::_notification(int p_what) {

	if (p_what==NOTIFICATION_ENTER_CANVAS) {

		if (is_visible()) {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
			add_to_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		}



	} else if (p_what==NOTIFICATION_EXIT_CANVAS) {

		if (is_visible()) {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
			remove_from_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		}
	} else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {

		if (is_visible()) {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
			add_to_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		} else {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
			remove_from_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		}

		update_configuration_warning();
	}
}
예제 #4
0
void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolygon>& p_navpoly) {

    if (p_navpoly==navpoly)
        return;

    if (navigation && nav_id!=-1) {
        navigation->navpoly_remove(nav_id);
        nav_id=-1;
    }
    if (navpoly.is_valid()) {
        navpoly->disconnect(CoreStringNames::get_singleton()->changed,this,"_navpoly_changed");
    }
    navpoly=p_navpoly;

    if (navpoly.is_valid()) {
        navpoly->connect(CoreStringNames::get_singleton()->changed,this,"_navpoly_changed");
    }

    if (navigation && navpoly.is_valid() && enabled) {
        nav_id = navigation->navpoly_create(navpoly,get_relative_transform_to_parent(navigation),this);
    }
    //update_gizmo();
    _change_notify("navpoly");
    update_configuration_warning();

}
예제 #5
0
void RemoteTransform::set_remote_node(const NodePath& p_remote_node) {

	remote_node=p_remote_node;
	if (is_inside_tree())
		_update_cache();

	update_configuration_warning();
}
예제 #6
0
void SoftBody::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_WORLD: {

			if (Engine::get_singleton()->is_editor_hint())
				add_change_receptor(this);

			RID space = get_world()->get_space();
			PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, space);
			PhysicsServer::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform());
			update_physics_server();
		} break;
		case NOTIFICATION_READY: {
			if (!parent_collision_ignore.is_empty())
				add_collision_exception_with(get_node(parent_collision_ignore));

		} break;
		case NOTIFICATION_TRANSFORM_CHANGED: {

			if (!simulation_started) {
				PhysicsServer::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform());

				_update_cache_pin_points_datas();
				// Submit bone attachment
				const int pinned_points_indices_size = pinned_points_indices.size();
				PoolVector<PinnedPoint>::Read r = pinned_points_indices.read();
				for (int i = 0; i < pinned_points_indices_size; ++i) {
					if (!r[i].spatial_attachment) {
						// Use soft body position to update the point position
						PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, (get_global_transform() * r[i].vertex_offset_transform).origin);
					} else {
						PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, (r[i].spatial_attachment->get_global_transform() * r[i].vertex_offset_transform).origin);
					}
				}
			}
		} break;
		case NOTIFICATION_VISIBILITY_CHANGED: {

			_update_pickable();

		} break;
		case NOTIFICATION_EXIT_WORLD: {

			PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, RID());

		} break;
	}

#ifdef TOOLS_ENABLED

	if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
		if (Engine::get_singleton()->is_editor_hint()) {
			update_configuration_warning();
		}
	}

#endif
}
예제 #7
0
void SoftBody::_changed_callback(Object *p_changed, const char *p_prop) {
	update_physics_server();
	_reset_points_offsets();
#ifdef TOOLS_ENABLED
	if (p_changed == this) {
		update_configuration_warning();
	}
#endif
}
예제 #8
0
void CollisionPolygon::set_polygon(const Vector<Point2> &p_polygon) {

	polygon = p_polygon;
	if (parent) {
		_build_polygon();
	}
	update_configuration_warning();
	update_gizmo();
}
예제 #9
0
파일: light_2d.cpp 프로젝트: Cybolic/godot
void Light2D::set_texture( const Ref<Texture>& p_texture) {

	texture=p_texture;
	if (texture.is_valid())
		VS::get_singleton()->canvas_light_set_texture(canvas_light,texture->get_rid());
	else
		VS::get_singleton()->canvas_light_set_texture(canvas_light,RID());

	update_configuration_warning();
}
예제 #10
0
void AnimationTree::set_tree_root(const Ref<AnimationNode> &p_root) {

	if (root.is_valid()) {
		root->disconnect("tree_changed", this, "_tree_changed");
	}

	root = p_root;

	if (root.is_valid()) {
		root->connect("tree_changed", this, "_tree_changed");
	}

	properties_dirty = true;

	update_configuration_warning();
}
예제 #11
0
void Particles2D::set_process_material(const Ref<Material> &p_material) {

	process_material = p_material;
	Ref<ParticlesMaterial> pm = p_material;
	if (pm.is_valid() && !pm->get_flag(ParticlesMaterial::FLAG_DISABLE_Z) && pm->get_gravity() == Vector3(0, -9.8, 0)) {
		//likely a new material, modify it!
		pm->set_flag(ParticlesMaterial::FLAG_DISABLE_Z, true);
		pm->set_gravity(Vector3(0, 98, 0));
	}
	RID material_rid;
	if (process_material.is_valid())
		material_rid = process_material->get_rid();
	VS::get_singleton()->particles_set_process_material(particles, material_rid);

	update_configuration_warning();
}
예제 #12
0
void CollisionShape::set_shape(const Ref<Shape> &p_shape) {

	if (!shape.is_null())
		shape->unregister_owner(this);
	shape = p_shape;
	if (!shape.is_null())
		shape->register_owner(this);
	update_gizmo();
	if (parent) {
		parent->shape_owner_clear_shapes(owner_id);
		if (shape.is_valid()) {
			parent->shape_owner_add_shape(owner_id, shape);
		}
	}

	update_configuration_warning();
}
예제 #13
0
void AnimatedSprite::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {

	if (frames.is_valid())
		frames->disconnect("changed", this, "_res_changed");
	frames = p_frames;
	if (frames.is_valid())
		frames->connect("changed", this, "_res_changed");

	if (!frames.is_valid()) {
		frame = 0;
	} else {
		set_frame(frame);
	}

	_change_notify();
	_reset_timeout();
	update();
	update_configuration_warning();
}
예제 #14
0
void WorldEnvironment::set_environment(const Ref<Environment> &p_environment) {

	if (is_inside_tree() && environment.is_valid() && get_viewport()->find_world()->get_environment() == environment) {
		get_viewport()->find_world()->set_environment(Ref<Environment>());
		remove_from_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id()));
		//clean up
	}

	environment = p_environment;
	if (is_inside_tree() && environment.is_valid()) {
		if (get_viewport()->find_world()->get_environment().is_valid()) {
			WARN_PRINT("World already has an environment (Another WorldEnvironment?), overriding.");
		}
		get_viewport()->find_world()->set_environment(environment);
		add_to_group("_world_environment_" + itos(get_viewport()->find_world()->get_scenario().get_id()));
	}

	update_configuration_warning();
}
예제 #15
0
파일: popup.cpp 프로젝트: Max-Might/godot
void Popup::_notification(int p_what) {

	if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
		if (popped_up && !is_visible_in_tree()) {
			popped_up = false;
			notification(NOTIFICATION_POPUP_HIDE);
			emit_signal("popup_hide");
		}

		update_configuration_warning();
	}

	if (p_what == NOTIFICATION_ENTER_TREE) {
//small helper to make editing of these easier in editor
#ifdef TOOLS_ENABLED
		if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
			set_as_toplevel(false);
		}
#endif
	}
}
예제 #16
0
void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh) {

	if (p_navmesh == navmesh)
		return;

	if (navigation && nav_id != -1) {
		navigation->navmesh_remove(nav_id);
		nav_id = -1;
	}
	navmesh = p_navmesh;

	if (navigation && navmesh.is_valid() && enabled) {
		nav_id = navigation->navmesh_create(navmesh, get_relative_transform(navigation), this);
	}

	if (debug_view && navmesh.is_valid()) {
		debug_view->cast_to<MeshInstance>()->set_mesh(navmesh->get_debug_mesh());
	}

	update_gizmo();
	update_configuration_warning();
}
예제 #17
0
void CollisionShape::set_shape(const Ref<Shape> &p_shape) {

	if (!shape.is_null()) {
		shape->unregister_owner(this);
		shape->disconnect("changed", this, "_shape_changed");
	}
	shape = p_shape;
	if (!shape.is_null()) {
		shape->register_owner(this);
		shape->connect("changed", this, "_shape_changed");
	}
	update_gizmo();
	if (parent) {
		parent->shape_owner_clear_shapes(owner_id);
		if (shape.is_valid()) {
			parent->shape_owner_add_shape(owner_id, shape);
		}
	}

	if (is_inside_tree())
		_shape_changed();
	update_configuration_warning();
}
예제 #18
0
void CollisionPolygon2D::set_polygon(const Vector<Point2>& p_polygon) {

	polygon=p_polygon;

	if (can_update_body) {
		for(int i=0;i<polygon.size();i++) {
			if (i==0)
				aabb=Rect2(polygon[i],Size2());
			else
				aabb.expand_to(polygon[i]);
		}
		if (aabb==Rect2()) {

			aabb=Rect2(-10,-10,20,20);
		} else {
			aabb.pos-=aabb.size*0.3;
			aabb.size+=aabb.size*0.6;
		}
		_update_parent();
	}
	update();
	update_configuration_warning();
}
예제 #19
0
void AnimationTree::set_animation_player(const NodePath &p_player) {
	animation_player = p_player;
	update_configuration_warning();
}
예제 #20
0
void SoftBody::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_WORLD: {

			if (Engine::get_singleton()->is_editor_hint()) {

				add_change_receptor(this);
			}

			RID space = get_world()->get_space();
			PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, space);
			update_physics_server();
		} break;
		case NOTIFICATION_READY: {
			if (!parent_collision_ignore.is_empty())
				add_collision_exception_with(get_node(parent_collision_ignore));

		} break;
		case NOTIFICATION_TRANSFORM_CHANGED: {

			if (Engine::get_singleton()->is_editor_hint()) {
				_reset_points_offsets();
				return;
			}

			PhysicsServer::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform());

			set_notify_transform(false);
			// Required to be top level with Transform at center of world in order to modify VisualServer only to support custom Transform
			set_as_toplevel(true);
			set_transform(Transform());
			set_notify_transform(true);

		} break;
		case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {

			if (!simulation_started)
				return;

			_update_cache_pin_points_datas();
			// Submit bone attachment
			const int pinned_points_indices_size = pinned_points.size();
			PoolVector<PinnedPoint>::Read r = pinned_points.read();
			for (int i = 0; i < pinned_points_indices_size; ++i) {
				if (r[i].spatial_attachment) {
					PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, r[i].spatial_attachment->get_global_transform().xform(r[i].offset));
				}
			}
		} break;
		case NOTIFICATION_VISIBILITY_CHANGED: {

			_update_pickable();

		} break;
		case NOTIFICATION_EXIT_WORLD: {

			PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, RID());

		} break;
	}

#ifdef TOOLS_ENABLED

	if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
		if (Engine::get_singleton()->is_editor_hint()) {
			update_configuration_warning();
		}
	}

#endif
}
예제 #21
0
void ParticleAttractor2D::set_particles_path(NodePath p_path) {

	path=p_path;
	_update_owner();
	update_configuration_warning();
}
예제 #22
0
void ARVRAnchor::set_anchor_id(int p_anchor_id) {
	// We don't check any bounds here, this anchor may not yet be active and just be a place holder until it is.
	// Note that setting this to 0 means this node is not bound to an anchor yet.
	anchor_id = p_anchor_id;
	update_configuration_warning();
};