Форум

Сообщения, созданные пользователем LukeVideo
17 ноября 2017 00:41
Hy,
I haven't used B4W in a while. I am trying a simple function in nodes. But the problem seems to be my ability too use transform object node.
I try to use R1 to change the location of the cube when clicking the sphere. Or i didn't use the math operation right but i see the in the logs that R1 increase but the cube doesn't move….

Could someone be so kind as to take a look at my file please.

Regard,
Luke.
30 августа 2017 11:12
Hy I have put these few lines of code together to do individual exports of every object in a scene.

DO NOT USE IN PROJECT FILE !!!!!
USE IN EMPTY FILE NEXT TO THE PROJECT FILE . If you don't understand what's going on don't use this, Thank you!
It imports exports and deletes, one after the other every object in a given blend file. It does the exports but you end up with a empty file.
But i find it useful because i had to link every object in a new file for each object and then go from one file to the other to do all the updates. I ended up with this solution because of the scope of the blender scripts. If you open a file you lose track of your script…
I have one file where i model all objects i need for my b4w app and when i'm done i open a new file with the script and it does all the exports for me and i get all the .json and .bin files i need to load in the project.

If you want to have a look, if you see any optimisation that could be done, let me know. Next thing is going to do a folder for each object group and export every object in a group in a separate folder. A matter of more for in…


import bpy

#create list to get all objects in external source file
sourceList = []
# path to the source file
filepath = "//source.blend"

# build a list of objects in the source file by loading data from it
with bpy.data.libraries.load(filepath) as (data_from, data_to):
data_to.objects = data_from.objects
# now append each object name to the sourceList
for object in data_to.objects:
if object is not None:
sourceList.append(object.name)
print(sourceList)

#UNLOAD DATA ! Else name get suffixes.001 .002 AND we have to re-import every object ONE AT A TIME to export them ONE BY ONE.
for o in bpy.data.objects:
o.select = True
bpy.ops.object.delete()

for mesh in bpy.data.meshes:
bpy.data.meshes.remove(mesh, do_unlink=True)


#now that we have a list lest iterate over it to import, exprort and delete every object
for object_name in sourceList:

#Append object to current scene
blendfile = '/home/user/blenderProject/source.blend'
section = '/Object'
directory = blendfile + section

bpy.ops.wm.append(filename=object_name, directory=directory)

#Add object to the list to later erase mesh from memory
meshes_to_remove = []
for ob in bpy.context.selected_objects:
meshes_to_remove.append(ob.data)

#Do the export
bpy.ops.export_scene.b4w_json(filepath="/home/lukevideo/blenders/scripting/"+object_name+".json")

# delete the object
bpy.ops.object.delete()
# Remove the meshes from memory too
for mesh in bpy.data.meshes:
bpy.data.meshes.remove(mesh, do_unlink=True)
print(meshes_to_remove)


print(bpy.data.meshes)
25 августа 2017 19:56
Thats exactly what i did. But i struggled i set position of container to relative !

Thanks for information.
25 августа 2017 12:06
Hy, thanks.
That's what i'm using. Only i use the basic app.js file and something has to be messing with the canvas CSS and i wonder if that could be changed. The top:0 and left:0 position:absolute are kind of breaking my styling. Nothing i can't fix with loads of important tags. But that isn't a tag you should use, right.
24 августа 2017 17:17
<canvas width="765" height="0" style="position: absolute; left: 0px; top: 0px; width: 765px; height: 0px;">
24 августа 2017 17:16
I am trying to add some css to my app to make it look good !
But the canvas for the app is messing it up by having css propertys inline and i would like to change them. Any ideas where i could find that ???
24 августа 2017 17:13
Not in my case. It just silently failed and look at me with disdain…
23 августа 2017 18:26
23 августа 2017 18:26
Oh My GOD !!
Thank you so much! I am glad that's not a bug ! But i just couldn't figure out what else !
I have never heard of that var = i syntax and i would never have thought of it… I will try to remember that!
B4W is a bit tricky.

How could i get more debug info from B4W because it just crashed and that was it.
23 августа 2017 13:21
I just noticed something else. On desktop if on intermediate width the menu doesn't show up. between 750 and 1200 px wide the menu disappears and the hamburger icon only appears on smaller than 750px.