WIP script: Nmap generator

Hi,
i’m now attached to write a script about “normal map generator”, i started few days ago and i have some questions:

here is the work plan:
the code should include in order:


#----------------------------------------------------------
# Script for normal map texture generator from object normal Hi-res mesh
#
# from selected object > view front
# create UV from view (must be top or front view)
# create new image (named "Nmap" and show in image editor
# bake normal map and create new texture slot, name this slot "Nmap_tex"
# save image "Nmap" and pack it
# ...
#
# NmapTool.py
#----------------------------------------------------------

import bpy
import os

# add new materiel to selected object
bpy.ops.material.new()

# add new texture slot to selected object material
bpy.ops.texture.new()

# create new image texture
bpy.ops.image.new(name="image", width=1024, height=1024, color=(1, 1, 1, 1), alpha=False, uv_test_grid=False, float=False)

#view object in TOP view
bpy.ops.view3d.viewnumpad(type='TOP')

# pass object in EDIT mode
bpy.ops.object.editmode_toggle()

# Create UV from view
bpy.ops.uv.project_from_view(orthographic=True, correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)

...

question:
1/ i saw already that the color code can be changed to value between 0>1, but i can’t get the right color (a simple light blue), but i can work with white color anyway :slight_smile:
can i copy color from the color picker in blender ? how ?

2/ i want to do: # create UV from top view…noway to find the good code…help needed

Hi,
i can’t get the code for bake.normal ??? do you know ?