IPOCurve.addBezier creates bad handles #1014

Closed
opened 2004-02-20 14:00:44 +01:00 by Roland Hess · 3 comments

Resolution: Fixed
Category: Python

%%%When creating bezier points in the IPOCurve module of the Python API,
the addBezier method as it currently stands creates useless handles
that lead to non-smooth animation regardless of the curve's
interpolation type. This makes creating smooth IPOCurves via Python
impossible. The addBezier functionality should mimic what happens
when you ctrl-click in the IPO window to add new points. I have heard
from two other Python scripters who had to abandon projects because
of this lack of functionality.

I have a two line patch for this problem, but obviously no commit
priveleges. I've posted this fix to the bf-Python board but seen no
action, so I'm posting it here.

Code snippet, with my fix, from IpoCurve_addBezier in bf-blender/
blender/source/blender/python/api2_2x/ipocurve.c:

bzt = icu->bezt + npoints;
bzt->vec[0][0] = x-1;
bzt->vec[1][0] = x;
bzt->vec[2][0] = x+1;
bzt->vec[0][1] = y-1;
bzt->vec[1][1] = y;
bzt->vec[2][1] = y+1;
bzt->h1= HD_AUTO; // new line - my fix
bzt->h2= HD_AUTO; // new line - my fix

Py_INCREF(Py_None);
return Py_None;

These two lines set the just-created handles to the Autosmooth type.
Using this fix, smooth curves can be achieved via the Python API.

%%%

**Resolution**: Fixed **Category**: Python %%%When creating bezier points in the IPOCurve module of the Python API, the addBezier method as it currently stands creates useless handles that lead to non-smooth animation regardless of the curve's interpolation type. This makes creating smooth IPOCurves via Python impossible. The addBezier functionality should mimic what happens when you ctrl-click in the IPO window to add new points. I have heard from two other Python scripters who had to abandon projects because of this lack of functionality. I have a two line patch for this problem, but obviously no commit priveleges. I've posted this fix to the bf-Python board but seen no action, so I'm posting it here. Code snippet, with my fix, from IpoCurve_addBezier in bf-blender/ blender/source/blender/python/api2_2x/ipocurve.c: ``` bzt = icu->bezt + npoints; bzt->vec[0][0] = x-1; bzt->vec[1][0] = x; bzt->vec[2][0] = x+1; bzt->vec[0][1] = y-1; bzt->vec[1][1] = y; bzt->vec[2][1] = y+1; bzt->h1= HD_AUTO; // new line - my fix bzt->h2= HD_AUTO; // new line - my fix ``` Py_INCREF(Py_None); return Py_None; These two lines set the just-created handles to the Autosmooth type. Using this fix, smooth curves can be achieved via the Python API. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

This task was automatically closed as archived as part of migration, because the project or tracker this task belonged to is no longer active.

This task was automatically closed as archived as part of migration, because the project or tracker this task belonged to is no longer active.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#1014
No description provided.