Geometry Nodes: add simulation support #104924
|
@ -41,6 +41,7 @@ _modules = [
|
|||
"properties_physics_common",
|
||||
"properties_physics_dynamicpaint",
|
||||
"properties_physics_field",
|
||||
"properties_physics_geometry_nodes",
|
||||
"properties_physics_rigidbody",
|
||||
"properties_physics_rigidbody_constraint",
|
||||
"properties_physics_fluid",
|
||||
|
|
|
@ -236,18 +236,6 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
|
|||
row.prop_decorator(obj, "display_bounds_type")
|
||||
|
||||
|
||||
class OBJECT_PT_baking(ObjectButtonsPanel, Panel):
|
||||
bl_label = "Baking"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
col = layout.column()
|
||||
col.label(text="Simulation Nodes Cache:")
|
||||
col.operator("object.simulation_nodes_cache_bake", text="Bake").selected = True
|
||||
col.operator("object.simulation_nodes_cache_delete", text="Delete").selected = True
|
||||
|
||||
|
||||
class OBJECT_PT_instancing(ObjectButtonsPanel, Panel):
|
||||
bl_label = "Instancing"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
@ -425,7 +413,6 @@ classes = (
|
|||
OBJECT_PT_motion_paths,
|
||||
OBJECT_PT_motion_paths_display,
|
||||
OBJECT_PT_display,
|
||||
OBJECT_PT_baking,
|
||||
OBJECT_PT_visibility,
|
||||
OBJECT_PT_lineart,
|
||||
OBJECT_PT_custom_props,
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from bpy.types import (
|
||||
Panel,
|
||||
)
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
|
||||
|
||||
class PHYSICS_PT_geometry_nodes(Panel):
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
bl_label = "Geometry Nodes"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def geometry_nodes_objects(cls, context):
|
||||
for ob in context.selected_editable_objects:
|
||||
if any([modifier.type == 'NODES' for modifier in ob.modifiers]):
|
||||
yield ob
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return any(cls.geometry_nodes_objects(context))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
if len(context.selected_editable_objects) > 1:
|
||||
bake_text = iface_("Bake Selected")
|
||||
else:
|
||||
bake_text = iface_("Bake")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("object.simulation_nodes_cache_bake", text=bake_text).selected = True
|
||||
row.operator("object.simulation_nodes_cache_delete", text="", icon='TRASH').selected = True
|
||||
|
||||
|
||||
classes = (
|
||||
PHYSICS_PT_geometry_nodes,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
register_class(cls)
|
Loading…
Reference in New Issue