Closed rainforeast closed 1 year ago
All shape mixing operations are done within Blender.
After you open blender, go to the scripting workspace:
Then, you can get the python path to a single Geometry Nodes parameter by right clicking the parameter's value:
The better option will be to do it by code. Below is a quickly written code to do that.
from dataset_generator.dataset_generator import save_obj_label
from common.bpy_util import save_obj, select_shape, select_objs, get_geometric_nodes_modifier, refresh_obj_in_viewport
from common.file_util import get_recipe_yml_obj
from common.input_param_map import load_shape_from_yml, get_input_param_map
def save_current_shape_and_label(dir, file_name):
# select the object in blender
obj = select_shape()
# get the geometric nodes modifier fo the object
gnodes_mod = get_geometric_nodes_modifier(obj)
save_obj_label(gnodes_mod, dir.joinpath(f"{file_name}.yml"))
dup_obj = save_obj(dir.joinpath(f"{file_name}.obj"))
select_objs(dup_obj)
return dup_obj
def load_sample(yml_file_path, recipe_file_path):
obj = select_shape()
# get the geometric nodes modifier of the object
gnodes_mod = get_geometric_nodes_modifier(obj)
recipe_yml_obj = get_recipe_yml_obj(recipe_file_path)
input_params_map = get_input_param_map(gnodes_mod, recipe_yml_obj)
try:
load_shape_from_yml(yml_file_path, input_params_map, ignore_sanity_check=True)
refresh_obj_in_viewport(obj)
except Exception as e:
print(repr(e))
Pseudo code for main
:
save_current_shape_and_label
load_sample
to load the newly created yml label file.Note that recipe_file_path
is in the following directory: https://github.com/threedle/GeoCode/tree/main/dataset_generator/recipe_files
With the hope that I correctly understood the first question, the code does not generate new Blend files, you'll have to follow the guidelines depicted in the paper and you can reuse parts from the existing Blend files to build a new shape program. I hope this helps.
I appreciate your clear explanation very much. That is very helpful.(' V ')
hello, thanks for sharing, I am very interested in your work, but I know very little about blender geometry node.I hope these are not dull questions
I hope to get your reply^-^