Constraint: Geometry Attribute
Add a new constraint called "Geometry Attribute", which directly samples vector, quaternion, or 4x4 matrix attributes from geometry and applies these to an object's or bone's transform. This can be used to transfer data generated by geometry nodes to the object or bone level. By default the constraint will sample a vector on the vertex domain. The default attribute is `position` for simplicity, but the attribute value does not have to have anything to do with neither the transform of the geometry object nor the geometry itself. Pull Request: https://projects.blender.org/blender/blender/pulls/136477
This commit is contained in:
committed by
Sybren A. Stüvel
parent
e2872c0bfe
commit
8f41d46d74
@@ -977,8 +977,35 @@ class ConstraintButtonsPanel:
|
||||
|
||||
self.draw_influence(layout, con)
|
||||
|
||||
def draw_geometry_attribute(self, context):
|
||||
layout = self.layout
|
||||
con = self.get_constraint(context)
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = True
|
||||
|
||||
self.target_template(layout, con, False)
|
||||
layout.prop(con, "apply_target_transform", text="Offset with Target Transform")
|
||||
|
||||
layout.prop(con, "attribute_name", text="Attribute Name")
|
||||
layout.prop(con, "data_type", text="Data Type")
|
||||
layout.prop(con, "domain", text="Domain")
|
||||
layout.prop(con, "sample_index", text="Sample Index")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(con, "mix_mode", text="Mix Mode", text_ctxt=i18n_contexts.constraint)
|
||||
|
||||
if con.data_type == 'FLOAT4X4':
|
||||
row = layout.row(heading="Enabled")
|
||||
row.prop(con, "mix_loc", text="Location", toggle=True)
|
||||
row.prop(con, "mix_rot", text="Rotation", toggle=True)
|
||||
row.prop(con, "mix_scl", text="Scale", toggle=True)
|
||||
row.label(icon='BLANK1')
|
||||
|
||||
self.draw_influence(layout, con)
|
||||
|
||||
# Parent class for constraint sub-panels.
|
||||
|
||||
|
||||
class ConstraintButtonsSubPanel:
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
@@ -1664,6 +1691,18 @@ class BONE_PT_bKinematicConstraint(BoneConstraintPanel, ConstraintButtonsPanel,
|
||||
def draw(self, context):
|
||||
self.draw_kinematic(context)
|
||||
|
||||
# Geometry Attribute Constraint.
|
||||
|
||||
|
||||
class OBJECT_PT_bGeometryAttributeConstraint(ObjectConstraintPanel, ConstraintButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
self.draw_geometry_attribute(context)
|
||||
|
||||
|
||||
class BONE_PT_bGeometryAttributeConstraint(BoneConstraintPanel, ConstraintButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
self.draw_geometry_attribute(context)
|
||||
|
||||
|
||||
classes = (
|
||||
# Object Panels
|
||||
@@ -1704,6 +1743,8 @@ classes = (
|
||||
OBJECT_PT_bTransformCacheConstraint_layers,
|
||||
OBJECT_PT_bArmatureConstraint,
|
||||
OBJECT_PT_bArmatureConstraint_bones,
|
||||
OBJECT_PT_bGeometryAttributeConstraint,
|
||||
|
||||
# Bone panels
|
||||
BONE_PT_bChildOfConstraint,
|
||||
BONE_PT_bTrackToConstraint,
|
||||
@@ -1743,6 +1784,7 @@ classes = (
|
||||
BONE_PT_bTransformCacheConstraint_layers,
|
||||
BONE_PT_bArmatureConstraint,
|
||||
BONE_PT_bArmatureConstraint_bones,
|
||||
BONE_PT_bGeometryAttributeConstraint,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
||||
Reference in New Issue
Block a user