Форум

Сообщения, созданные пользователем jem
26 июля 2017 23:03
jem
Thank you Will.

After converting resources, building and deploying my application, I was looking at my web server access logs and I wasn't seeing any of the PVR or DDS files being downloaded. Only the original PNGs. I had forgotten to include flags for these file types in my apps init values JSON. I added:

assets_dds_available: true,
assets_min50_available: true,
assets_pvr_available: true,
assets_gzip_available: true

just to see what they do and it works! Very cool. Thanks for the help.
-Jeremy
25 июля 2017 21:59
jem
Hi All,
I was experimenting with the convert resources function of the B4W project manager. I saw that it was trying to convert my PNG texture files to many formats including PowerVR compressed texture. This format seems to be supported by the PowerVR GPUs. I guess this means iOS support for compressed textures on iOS.

I have a few questions:
1. Is this required for iOS support or will the runtime fall back to PNG?
2. I am running windows on my dev box. I had to put the PVRTexToolCLI.exe in the %path% variable. Is this the correct way to do it?

Thanks!
-Jem
19 июля 2017 21:20
jem
Ok. I figured this out. It was a noob problem. The answer seems to be that this requires two materials. One material for the base color and a second material for the alpha blend. The PNG with alpha is applied to the alpha blend material and that is rendered in front of the base color.

Could be a better way, but this works well.
-Jem
19 июля 2017 21:15
jem
Hi,
When I compile an application, the process fails due to a Unicode read error in compile_b4w.py. I am running B4W 17.06.

I have also seen this behavior in 17.04, but I was waiting for 17.06 to test because Ivan suggested a fix for a related issue was coming in 17.06.
https://www.blend4web.com/en/forums/topic/3184/

If anyone else is having this issue, change line 434 in compile_b4w.py
from:
f = open(abs_path)
to:
f = open(abs_path,encoding="UTF8")

per Ivan's suggestion in the other thread.

I am running Windows 10 and use Notepad++ as my text editor.

Here is the error message from python:

Traceback (most recent call last):
File "D:\blend4web_ce\scripts\compile_b4w.py", line 567, in
run()
File "D:\blend4web_ce\scripts\compile_b4w.py", line 296, in run
append_externs_items(SRC_EXT_FILES, externs_js, externs_gen_file)
File "D:\blend4web_ce\scripts\compile_b4w.py", line 435, in append_externs_items
text = f.read()
File "C:\Program Files\Blender Foundation\Blender\2.78\python\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1500: character maps to

Thanks,
Jem
18 июля 2017 18:05
jem
Would someone kindly point me to an example with a simple texture that uses png with alpha? My goal is to use a texture with a png with alpha over a material with a basic diffuse color. The color should be visible through the transparent sections of the image.

When I try this, the transparent sections of the image appear black.

Thanks,
Jem
18 июля 2017 17:52
jem
Hi Will,
Thanks for the response. I understand your suggestion and I have tried implementing something like it. You are correct, the result does not simplify a fairly large logic tree. This does work. It is a valid technique.

I was looking for a more compact solution. My hope was to make a solution that was easily reusable from project-to-project and a bit more intelligible.

I am working not with JS callbacks to try to accomplish the same thing.
Thanks!
Jem
13 июля 2017 20:40
jem
Hi,

Is there a way of avoiding hard coding object names into B4W logic nodes? I would like to pass the object name to the node is a value in a variable. This would make some of my logic trees much more compact and understandable.

For instance, the "Play Animation" node requires an object as its target. I would rather pass it a target in a variable.

Thanks!
Jem
12 июля 2017 04:22
jem
Hi Will,
I tried your suggestion. It did not change the behavior of the new copied child object. The copied child object will not animate once it is attached to another object with either one of these constraints.

But… there is something in what you said. You described animating the empty (the parent) to move the child. That is not what I was trying to do. I was applying an animation to the child object, not the empty. This usually works in B4W, but not in this scenario where the objects are copies and not straight from from the blend file.

I liked this approach because the empty could be easily repositioned and the empty would act as a LCS for the child's animation.

Maybe this is impossible. Maybe I am doing it wrong. I am certain that there is a better technique.

I will tinker with animating the empties rather than the children, as you said.

Thanks,
Jem
11 июля 2017 22:59
jem
Hi,
I am trying to build a scene were objects are created dynamically by copying other objects in the scene, repositioned (translation), and then have an animation action applied to them in that new location. I cannot get this to work.

When I want to animate an object that will be translated, I assign it to a parent. This parent is usually an empty. I can then translate the parent and apply the animation action to the child. This technique works well.

However, I now want to create new objects with the m_obj.copy() API and animate them. I have tried this without copying the parent and it did not work. Once the animation action is applied to the copied object, the action is preformed relative to the scene origin rather than the location where the copied object was place into the scene. This makes sense, because animation actions seem to be preformed relative to their parent's coordinate system, which, in this case, is the scene.

So I tried to copy both the parent and the child, create a constraint between them, translate the parent, and then apply the animation action. This does not work. The new parent and child objects do appear in the scene, but the animation will not play. The new child remains fixed to the new parent.

Here is the code in my callback

function move_cube_cb(in_params, out_params) {
    //console.log("In move_cube_cb");
	var src_obj_child = m_scs.get_object_by_name("ChildGreenCube");
	var src_obj_parent = m_scs.get_object_by_name("ParentRedCube");
	var cube_copy_child = m_obj.copy(src_obj_child, "cube_copy_child", true);
	var cube_copy_parent = m_obj.copy(src_obj_parent, "cube_copy_parent", true);
	m_const.append_semi_stiff(cube_copy_child, cube_copy_parent, m_vec3.create());
	m_scs.append_object(cube_copy_child);
	m_scs.append_object(cube_copy_parent);
	m_trans.set_translation(cube_copy_parent, -5, 0, 4);
	m_anim.apply(cube_copy_child, "MoveAway", 0); 
	m_anim.play(cube_copy_child, anim_callback, 0);
}


Is there a better way do doing this? Is there something wrong with this code?

Any help that you can provide would be appreciated.
You have an awesome product!
-Jem
21 июня 2017 18:12
jem
Hi,
I am new to Blend4Web. I am trying to create a combined solution that has a web page with a B4W custom application embedded within that page. The page has several ordinary HTML inputs in a form. I need the page and the B4W application to be able to communicate in both directions (the B4W app should be able to set values in the page and JavaScript in the page should be able to pass value into the B4W app). Through trial and error, I've been able to get something like this working, but I worry that my solution is not the best solution. I would appreciate some guidance.

To send data from the B4W app to the page I have used B4W logic. Specifically, I've used the JS Callback node to execute a custom JS function to read B4W logic parameters and write those values to HTML inputs on the page. This seems to work well.

My solution to send data from the page into the B4W app is a bit more convoluted:
1. A listener on the page observes a change to an HTML form value.
2. That listener executes an on page JS function that triggers an Entry Point node in a B4W logic flow.
3. That logic flow then uses a JS Callback node to read data from the HTML form in the page.
4. The logic flow then updates the scene

This works but it is indirect. Is there a better technique? Can input values from a page be pushed directly into the B4W app and have that push of values trigger an event in B4W?

Blend4Web is an amazing solution. Thanks for the hard work.
-jem