工作流程

开发任何产品是一个创造性的过程,需要许多参与者谁拥有不同的技能和经验。然而不论事情是多么的复杂,是它总是能够分离出许多生产阶段,其中的大部分资产和源代码是创作的目标。

当使用Blend4Web工作流程如下:

  1. 创建一个新项目

  2. Creating Scenes
  3. Preparing a Scene to Use in Blend4Web
  4. 导出场景。

  5. 应用程序开发

  6. Project Building.
  7. Project Deploying.

Creating a New Project

The work on a project, of course, should always start with creating it.

The easiest way to create a new project is to use the Project Manager. To do it, press the Create New Project button at the top of the Project Manager’s main window.

The other way is to use the project.py command line script, which is more versatile. Working with this script is described here.

Creating Scenes

Scenes are contained in blend files. Project Manager can automatically create a blend file with a basic scene upon creating a new project. Additional blend files can be created and attached to a project.

Scenes for Blend4Web are created in the same manner as the scenes for Blender itself, with only minor differences. The process of working on a scene could be separated into several stages:

  1. Modeling the scene objects
  2. Setting up materials
  3. Animating objects
  4. Creating scene logic (this part is exclusive for Blend4Web engine and does not apply to regular Blender scenes)

It should be noted that not every project may require all of these stages. More simple scene might not feature any animations or even any materials aside from the default ones.

The order of the stages is also not strict and can be interchaged to a certain degree (for example, you won’t probably animate an object before creating it, but you can create a material for it beforehand).

除了一般的阶段如建模,贴图,动画等,场景应该在做好在引擎中的准备。

一般建议:

  1. 我们强烈建议将Blend文件保存在 projects/project_name/blender 目录中。程序中不需要加载的辅助文件 (例如,引用)等,也该在这个文件夹下。

  2. 图像和媒体文件应该是在外部和位于 projects/project_name/assets 目录。

  3. 你将导出的文件应包含实际所需 (对象、 材料、 材质、 动画等) 的应用程序中的资源。

  4. 场景组件应该有不同的识别名称。他们不应该叫 “Cube.001”, “Material” 或者 “Armature”.

  5. 我们建议您实践从其他文件 (库)来链接组件。

Preparing a Scene to Use in Blend4Web

除了一般的阶段如建模,贴图,动画等,场景应该在做好在引擎中的准备。

在浏览器显示场景

当使用 本地开发服务器 有可能使用预览当前场景的 Fast Preview 按钮,位于Blender的 Render ->Development Server 面板。在这种情况下,场景将里面的一些临时存储被导出并在预览查看器应用程序加载。

另一种方法是使用 运行在预览查看器 导出选项。在这种情况下,场景将导出后立即显示在预览查看器应用程序。

导出场景

导出过程将场景从Blender格式转换为 Blend4Web 所使用的格式之一。

_images/workflow_export_scheme.png

有两种格式 ︰ JSON 和 HTML。

HTML格式用于简单的单机应用中,所有的资源都打包成可以很容易地部署到一个网页的一个HTML文件。

JSON格式,可用于创建各种项目,但它也提供了许多额外的功能使得它可以创建需要编程的复杂项目。格式的不同和导出选项在 Export Formats 一章描述。

若要导出场景,请从 文件 > 导出 菜单选择 Blend4Web (.json)Blend4Web (.html) ,或者在操作符搜索菜单(按 空格键 的时候出现)输入``b4w export``

注解

如果场景使用Blender功能尚不由 Blend4Web 引擎支持,可能会在导出过程中发生错误。在导出错误中列出 此表.

导出选项中详细描述在 相应章节.

应用程序开发

This section only applies to the project types other than Web Player HTML and Web Player JSON.

在此阶段的应用已经被创建。逻辑场景加载和用户交互使用JavaScript编写。应用程序开发人员笔记中给出了 相应章节.

Project Building

After development of a project is completed, it should be built so it can then be used outside of the SDK.

Project building can be performed by clicking the build project link in the Project Manager.

Before building a project, you might want to convert media resources used in the project, which can help to minimize its size.

Project Deploying

After project development is completed, the project can be deployed so it can be used outside of the Blend4Web SDK. Project deployment is performed by clicking the deploy project link that can be found in the Operations command list on the right side of the project entry in the main window of the Project Manager.

Clicking this link will cause Project Manager to perform all necessary operations and to deploy the project.

The deployed project has a form of an archive that contains all project files. This archive can be saved to any place on your disc with the use of a standard Save File dialogue in the web browser you are using.

A complete project can be placed on a web server.

To do it, extract the project files from the archive dowloanded from the Project Manager and upload them to your web server (while retaining inner file structure) by means of FTP, SSH or any other file transfer protocol suppored by the server. After doing this, you only need to place the project on a web page using, for example, an iframe container.

Deploying project to web server is described in a dedicated section of the Project Manager chapter.