diff --git a/randomiser/random_all/operators.py b/randomiser/random_all/operators.py index 56f99d2..b1ccb03 100644 --- a/randomiser/random_all/operators.py +++ b/randomiser/random_all/operators.py @@ -134,11 +134,15 @@ def execute(self, context): _type_ _description_ """ + + ### ALL if bpy.data.scenes["Scene"].seed_properties.seed_toggle: # = True seed(bpy.data.scenes["Scene"].seed_properties.seed) + tot_frame_no = bpy.context.scene.rand_all_properties.tot_frame_no + ### TRANSFORMS bpy.data.scenes["Scene"].frame_current = 0 - tot_frame_no = bpy.context.scene.rand_all_properties.tot_frame_no + x_pos_vals = [] y_pos_vals = [] z_pos_vals = [] @@ -179,6 +183,69 @@ def execute(self, context): getattr(bpy.context.scene.camera, value_str)[2] * rad2deg ) + ### GEOMETRY + bpy.data.scenes["Scene"].frame_current = 0 + + all_geom_dict = {} + cs = bpy.context.scene + for gng_idx in range(len(cs.socket_props_per_gng.collection)): + # get this subpanel's GNG + subpanel_gng = cs.socket_props_per_gng.collection[gng_idx] + tmp_GNG = subpanel_gng.name + print(tmp_GNG) + + sockets_props_collection = cs.socket_props_per_gng.collection[ + subpanel_gng.name + ].collection + + list_parent_nodes_str = [ + sckt.name.split("_")[0] for sckt in sockets_props_collection + ] + list_input_nodes = [ + bpy.data.node_groups[subpanel_gng.name].nodes[nd_str] + for nd_str in list_parent_nodes_str + ] + + list_input_nodes_sorted = sorted( + list_input_nodes, key=lambda x: x.name + ) + for i_n, nd in enumerate(list_input_nodes_sorted): + # add sockets for this node in the subseq rows + for sckt in nd.outputs: + print("i_n", i_n) + print("nd", nd) + print( + getattr( + sckt, + "default_value", + ) + ) + + tmp_values = [] + for idx in range(tot_frame_no): + bpy.app.handlers.frame_change_pre[0]("dummy") + bpy.data.scenes["Scene"].frame_current = idx + bpy.ops.node.randomise_all_geometry_sockets( + "INVOKE_DEFAULT" + ) # issue + # w/ this being called so often - + # might need moved to diff for loop? + tmp_values.append( + getattr( + sckt, + "default_value", + ) + ) + + print(tmp_values) + tmp_sck = nd.name + all_geom_dict[tmp_GNG] = tmp_sck + GNG_sck_values_str = tmp_GNG + tmp_sck + GNG_sck_values_str = "Values " + GNG_sck_values_str + print(GNG_sck_values_str) + all_geom_dict[GNG_sck_values_str] = tmp_values + + print(all_geom_dict) data = { "location_str": loc_value_str, "loc_x": x_pos_vals, @@ -188,9 +255,10 @@ def execute(self, context): "rot_x": x_rot_vals, "rot_y": y_rot_vals, "rot_z": z_rot_vals, + "geometry": all_geom_dict, } - path_to_file = pathlib.Path.home() / "tmp" / "transform_test.json" + path_to_file = pathlib.Path.home() / "tmp" / "transform_geom_test.json" with open(path_to_file, "w") as out_file_obj: # convert the dictionary into text diff --git a/randomiser/save_parameter_outputs_geom_test_in_Blender.py b/randomiser/save_parameter_outputs_geom_test_in_Blender.py index b709d8e..e36a8a3 100644 --- a/randomiser/save_parameter_outputs_geom_test_in_Blender.py +++ b/randomiser/save_parameter_outputs_geom_test_in_Blender.py @@ -128,13 +128,9 @@ # bpy.data.scenes['Scene'].socket_props_per_material.collection[0].collection[1].max_rgba_4d[0-3] -# Min-max Geom values - +### ALL if bpy.data.scenes["Scene"].seed_properties.seed_toggle: # = True seed(bpy.data.scenes["Scene"].seed_properties.seed) - - -### ALL tot_frame_no = bpy.context.scene.rand_all_properties.tot_frame_no ### TRANSFORMS