fix: transform
This commit is contained in:
parent
04e62ba030
commit
17127fc778
35
operators.py
35
operators.py
|
|
@ -62,15 +62,16 @@ def get_text_strip_settings(context):
|
||||||
|
|
||||||
# bl_rna.propertiesから全プロパティを取得
|
# bl_rna.propertiesから全プロパティを取得
|
||||||
if hasattr(text_strip, 'bl_rna') and hasattr(text_strip.bl_rna, 'properties'):
|
if hasattr(text_strip, 'bl_rna') and hasattr(text_strip.bl_rna, 'properties'):
|
||||||
|
# デバッグ: すべてのプロパティ名を出力
|
||||||
|
all_prop_names = [p.identifier for p in text_strip.bl_rna.properties]
|
||||||
|
print(f"[VoiceVox Debug] 利用可能なプロパティ: {all_prop_names}")
|
||||||
|
|
||||||
for prop in text_strip.bl_rna.properties:
|
for prop in text_strip.bl_rna.properties:
|
||||||
prop_name = prop.identifier
|
prop_name = prop.identifier
|
||||||
|
|
||||||
# スキップするプロパティ
|
# スキップするプロパティ
|
||||||
if prop_name in skip_properties:
|
if prop_name in skip_properties:
|
||||||
continue
|
print(f"[VoiceVox Debug] スキップ(skip_properties): {prop_name}")
|
||||||
|
|
||||||
# 読み取り専用プロパティはスキップ
|
|
||||||
if prop.is_readonly:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# プロパティの値を取得
|
# プロパティの値を取得
|
||||||
|
|
@ -84,10 +85,30 @@ def get_text_strip_settings(context):
|
||||||
settings['position_y'] = value[1]
|
settings['position_y'] = value[1]
|
||||||
except (TypeError, IndexError):
|
except (TypeError, IndexError):
|
||||||
pass
|
pass
|
||||||
|
# transformは子プロパティを個別にコピー(readonly だが子プロパティは書き込み可能)
|
||||||
|
elif prop_name == 'transform':
|
||||||
|
print(f"[VoiceVox Debug] transform プロパティを発見: {value}")
|
||||||
|
if hasattr(value, 'bl_rna') and hasattr(value.bl_rna, 'properties'):
|
||||||
|
print(f"[VoiceVox Debug] transform の子プロパティを列挙中...")
|
||||||
|
for transform_prop in value.bl_rna.properties:
|
||||||
|
transform_prop_name = transform_prop.identifier
|
||||||
|
if transform_prop.is_readonly:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
transform_value = getattr(value, transform_prop_name)
|
||||||
|
settings[f'transform_{transform_prop_name}'] = transform_value
|
||||||
|
print(f"[VoiceVox] コピー: transform.{transform_prop_name} = {transform_value}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[VoiceVox] transform.{transform_prop_name} の取得をスキップ: {e}")
|
||||||
|
else:
|
||||||
|
print(f"[VoiceVox Debug] transform に bl_rna.properties がありません")
|
||||||
else:
|
else:
|
||||||
settings[prop_name] = value
|
# 通常のプロパティ: readonlyはスキップ
|
||||||
|
if prop.is_readonly:
|
||||||
print(f"[VoiceVox] コピー: {prop_name} = {value}")
|
print(f"[VoiceVox Debug] スキップ(readonly): {prop_name}")
|
||||||
|
else:
|
||||||
|
settings[prop_name] = value
|
||||||
|
print(f"[VoiceVox] コピー: {prop_name} = {value}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[VoiceVox] {prop_name} の取得をスキップ: {e}")
|
print(f"[VoiceVox] {prop_name} の取得をスキップ: {e}")
|
||||||
|
|
||||||
|
|
|
||||||
25
subtitles.py
25
subtitles.py
|
|
@ -73,8 +73,20 @@ class SubtitleManager:
|
||||||
position_x = all_settings.pop('position_x', 0.5)
|
position_x = all_settings.pop('position_x', 0.5)
|
||||||
position_y_val = all_settings.pop('position_y', position_y)
|
position_y_val = all_settings.pop('position_y', position_y)
|
||||||
|
|
||||||
# 全てのプロパティを設定
|
# Transform関連のプロパティを分離
|
||||||
|
transform_settings = {}
|
||||||
|
other_settings = {}
|
||||||
|
|
||||||
for prop, value in all_settings.items():
|
for prop, value in all_settings.items():
|
||||||
|
if prop.startswith('transform_'):
|
||||||
|
# transform_offset_x → offset_x
|
||||||
|
transform_prop_name = prop[len('transform_'):]
|
||||||
|
transform_settings[transform_prop_name] = value
|
||||||
|
else:
|
||||||
|
other_settings[prop] = value
|
||||||
|
|
||||||
|
# 通常のプロパティを設定
|
||||||
|
for prop, value in other_settings.items():
|
||||||
try:
|
try:
|
||||||
setattr(text_strip, prop, value)
|
setattr(text_strip, prop, value)
|
||||||
print(f"[Subtitle] 設定: {prop} = {value}")
|
print(f"[Subtitle] 設定: {prop} = {value}")
|
||||||
|
|
@ -91,6 +103,17 @@ class SubtitleManager:
|
||||||
except (AttributeError, TypeError) as e:
|
except (AttributeError, TypeError) as e:
|
||||||
print(f"[Subtitle] location プロパティは利用できません: {e}")
|
print(f"[Subtitle] location プロパティは利用できません: {e}")
|
||||||
|
|
||||||
|
# Transformプロパティを設定
|
||||||
|
if transform_settings and hasattr(text_strip, 'transform'):
|
||||||
|
for prop, value in transform_settings.items():
|
||||||
|
try:
|
||||||
|
setattr(text_strip.transform, prop, value)
|
||||||
|
print(f"[Subtitle] 設定: transform.{prop} = {value}")
|
||||||
|
except AttributeError:
|
||||||
|
print(f"[Subtitle] transform.{prop} プロパティは利用できません(スキップ)")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[Subtitle] transform.{prop} の設定に失敗: {e}")
|
||||||
|
|
||||||
print(f"Subtitle added: '{text}' at frame {frame_start}")
|
print(f"Subtitle added: '{text}' at frame {frame_start}")
|
||||||
|
|
||||||
return text_strip
|
return text_strip
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user